├── .github └── workflows │ └── maven-publish.yml ├── .gitignore ├── LICENSE ├── README.md ├── changelog.md ├── dependency-reduced-pom.xml ├── libs ├── HMCCosmetics-2.7.7.jar ├── Jobs5.2.2.3.jar └── zItems-1.0.0.jar ├── pom.xml └── src ├── fr └── maxlego08 │ └── menu │ ├── MenuItemStack.java │ ├── MenuPlugin.java │ ├── ZButtonManager.java │ ├── ZCommand.java │ ├── ZCommandArgument.java │ ├── ZCommandManager.java │ ├── ZInventory.java │ ├── ZInventoryManager.java │ ├── api │ ├── ButtonManager.java │ ├── Inventory.java │ ├── InventoryListener.java │ ├── InventoryManager.java │ ├── InventoryOption.java │ ├── attribute │ │ ├── Attribute.java │ │ └── IAttribute.java │ ├── button │ │ ├── Button.java │ │ ├── ButtonOption.java │ │ ├── DefaultButtonValue.java │ │ ├── PaginateButton.java │ │ ├── PerformButton.java │ │ ├── PermissibleButton.java │ │ ├── PlaceholderButton.java │ │ ├── SlotButton.java │ │ └── buttons │ │ │ ├── BackButton.java │ │ │ ├── HomeButton.java │ │ │ ├── InventoryButton.java │ │ │ ├── NextButton.java │ │ │ ├── NoneButton.java │ │ │ └── PreviousButton.java │ ├── checker │ │ ├── InventoryLoadRequirement.java │ │ └── InventoryRequirementType.java │ ├── command │ │ ├── Command.java │ │ ├── CommandArgument.java │ │ └── CommandManager.java │ ├── dupe │ │ ├── DupeItem.java │ │ └── DupeManager.java │ ├── enchantment │ │ ├── Enchantments.java │ │ └── MenuEnchantment.java │ ├── enums │ │ ├── ItemVerification.java │ │ ├── MenuItemRarity.java │ │ ├── MessageType.java │ │ └── PlaceholderAction.java │ ├── event │ │ ├── CancelledMenuEvent.java │ │ ├── FastEvent.java │ │ ├── MenuEvent.java │ │ └── events │ │ │ ├── ButtonLoadEvent.java │ │ │ ├── ButtonLoaderRegisterEvent.java │ │ │ ├── InventoryLoadEvent.java │ │ │ └── PlayerOpenInventoryEvent.java │ ├── font │ │ └── FontImage.java │ ├── itemstack │ │ ├── ItemStackSimilar.java │ │ └── TrimConfiguration.java │ ├── loader │ │ ├── ActionLoader.java │ │ ├── ButtonLoader.java │ │ ├── MaterialLoader.java │ │ └── PermissibleLoader.java │ ├── pattern │ │ ├── Pattern.java │ │ └── PatternManager.java │ ├── players │ │ ├── Data.java │ │ ├── DataManager.java │ │ ├── PlayerData.java │ │ └── inventory │ │ │ ├── InventoriesPlayer.java │ │ │ └── InventoryPlayer.java │ ├── requirement │ │ ├── Action.java │ │ ├── ConditionalName.java │ │ ├── Permissible.java │ │ ├── RefreshRequirement.java │ │ ├── Requirement.java │ │ ├── data │ │ │ ├── ActionPlayerData.java │ │ │ └── ActionPlayerDataType.java │ │ └── permissible │ │ │ ├── CurrencyPermissible.java │ │ │ ├── ItemPermissible.java │ │ │ ├── JobPermissible.java │ │ │ ├── LuckpermPermissible.java │ │ │ ├── PermissionPermissible.java │ │ │ ├── PlaceholderPermissible.java │ │ │ └── PlayerNamePermissible.java │ ├── scheduler │ │ └── ZScheduler.java │ ├── sound │ │ └── SoundOption.java │ ├── utils │ │ ├── CompatibilityUtil.java │ │ ├── IMessage.java │ │ ├── LoreType.java │ │ ├── MapConfiguration.java │ │ ├── MessageSender.java │ │ ├── MetaUpdater.java │ │ ├── OpenLink.java │ │ ├── OpenWithItem.java │ │ ├── Placeholders.java │ │ ├── TrimHelper.java │ │ ├── TypedMapAccessor.java │ │ └── YamlConfigurationAccessor.java │ └── website │ │ └── WebsiteManager.java │ ├── button │ ├── ZButton.java │ ├── ZPerformButton.java │ ├── ZPermissibleButton.java │ ├── ZPlaceholderButton.java │ ├── ZSlotButton.java │ ├── buttons │ │ ├── ZBackButton.java │ │ ├── ZHomeButton.java │ │ ├── ZInventoryButton.java │ │ ├── ZJumpButton.java │ │ ├── ZMainMenuButton.java │ │ ├── ZNextButton.java │ │ ├── ZNoneButton.java │ │ └── ZPreviousButton.java │ └── loader │ │ ├── BackLoader.java │ │ ├── HomeLoader.java │ │ ├── InventoryLoader.java │ │ ├── JumpLoader.java │ │ ├── MainMenuLoader.java │ │ ├── NextLoader.java │ │ ├── NoneLoader.java │ │ ├── PluginLoader.java │ │ └── PreviousLoader.java │ ├── command │ ├── VCommand.java │ ├── VCommandManager.java │ └── commands │ │ ├── CommandInventory.java │ │ ├── CommandMenu.java │ │ ├── CommandMenuCreate.java │ │ ├── CommandMenuDocumentation.java │ │ ├── CommandMenuEditor.java │ │ ├── CommandMenuGiveOpenItem.java │ │ ├── CommandMenuList.java │ │ ├── CommandMenuOpen.java │ │ ├── CommandMenuOpenMainMenu.java │ │ ├── CommandMenuSave.java │ │ ├── CommandMenuTestDupe.java │ │ ├── CommandMenuVersion.java │ │ ├── players │ │ ├── CommandMenuPlayers.java │ │ ├── CommandMenuPlayersAdd.java │ │ ├── CommandMenuPlayersClearAll.java │ │ ├── CommandMenuPlayersClearPlayer.java │ │ ├── CommandMenuPlayersGet.java │ │ ├── CommandMenuPlayersKeys.java │ │ ├── CommandMenuPlayersRemove.java │ │ ├── CommandMenuPlayersSet.java │ │ └── CommandMenuPlayersSubtract.java │ │ ├── reload │ │ ├── CommandMenuReload.java │ │ ├── CommandMenuReloadCommand.java │ │ ├── CommandMenuReloadConfig.java │ │ └── CommandMenuReloadInventory.java │ │ └── website │ │ ├── CommandMenuDisconnect.java │ │ ├── CommandMenuDownload.java │ │ ├── CommandMenuInventories.java │ │ ├── CommandMenuLogin.java │ │ └── CommandMenuMarketplace.java │ ├── dupe │ ├── DupeListener.java │ ├── NMSDupeManager.java │ └── PDCDupeManager.java │ ├── enchantment │ ├── ZEnchantments.java │ └── ZMenuEnchantment.java │ ├── exceptions │ ├── ButtonAlreadyRegisterException.java │ ├── InventoryAlreadyExistException.java │ ├── InventoryButtonException.java │ ├── InventoryException.java │ ├── InventoryFileNotFound.java │ ├── InventoryOpenException.java │ ├── InventorySizeException.java │ ├── InventoryTypeException.java │ ├── ItemCreateException.java │ ├── ItemEnchantException.java │ ├── ItemFlagException.java │ └── ListenerNullException.java │ ├── font │ ├── EmptyFont.java │ └── ItemsAdderFont.java │ ├── inventory │ ├── VInventory.java │ ├── VInventoryManager.java │ └── inventories │ │ └── InventoryDefault.java │ ├── itemstack │ ├── FullSimilar.java │ ├── LoreSimilar.java │ ├── MaterialSimilar.java │ ├── ModelIdSimilar.java │ └── NameSimilar.java │ ├── listener │ ├── AdapterListener.java │ ├── HeadDatabaseListener.java │ ├── ListenerAdapter.java │ └── SwapKeyListener.java │ ├── loader │ ├── ActionPlayerDataLoader.java │ ├── CommandLoader.java │ ├── InventoryLoader.java │ ├── MenuItemStackLoader.java │ ├── OpenLinkLoader.java │ ├── PatternLoader.java │ ├── RefreshRequiementLoader.java │ ├── RequirementLoader.java │ ├── ZButtonLoader.java │ ├── ZPermissibleLoader.java │ ├── actions │ │ ├── ActionBarLoader.java │ │ ├── BackLoader.java │ │ ├── BookLoader.java │ │ ├── BroadcastLoader.java │ │ ├── BroadcastSoundLoader.java │ │ ├── ChatLoader.java │ │ ├── CloseLoader.java │ │ ├── ConnectLoader.java │ │ ├── ConsoleCommandLoader.java │ │ ├── CurrencyDepositLoader.java │ │ ├── CurrencyWithdrawLoader.java │ │ ├── DataLoader.java │ │ ├── DiscordComponentV2Loader.java │ │ ├── DiscordLoader.java │ │ ├── InventoryLoader.java │ │ ├── LuckPermissionSetLoader.java │ │ ├── MessageLoader.java │ │ ├── PlayerCommandLoader.java │ │ ├── RefreshLoader.java │ │ ├── ShopkeeperLoader.java │ │ ├── SoundLoader.java │ │ ├── TeleportLoader.java │ │ └── TitleLoader.java │ ├── deluxemenu │ │ ├── ButtonDeluxeMenuLoader.java │ │ ├── DeluxeMenuCommandUtils.java │ │ └── InventoryDeluxeMenuLoader.java │ ├── materials │ │ ├── ArmorLoader.java │ │ ├── Base64Loader.java │ │ ├── EcoLoader.java │ │ ├── HeadDatabaseLoader.java │ │ ├── HmccosmeticsLoader.java │ │ ├── ItemsAdderLoader.java │ │ ├── MagicCosmeticsLoader.java │ │ ├── NexoLoader.java │ │ ├── NovaLoader.java │ │ ├── OraxenLoader.java │ │ ├── SlimeFunLoader.java │ │ ├── ZHeadLoader.java │ │ └── ZItemsLoader.java │ └── permissible │ │ ├── CurrencyPermissibleLoader.java │ │ ├── ItemPermissibleLoader.java │ │ ├── JobPermissibleLoader.java │ │ ├── LuckPermPermissibleLoader.java │ │ ├── PermissionPermissibleLoader.java │ │ ├── PlaceholderPermissibleLoader.java │ │ ├── PlayerNamePermissibleLoader.java │ │ └── RegexPermissibleLoader.java │ ├── packet │ ├── FakeInventory.java │ ├── PacketListener.java │ └── PacketUtils.java │ ├── pattern │ ├── ZPattern.java │ └── ZPatternManager.java │ ├── placeholder │ ├── AutoPlaceholder.java │ ├── DistantPlaceholder.java │ ├── LocalPlaceholder.java │ └── Placeholder.java │ ├── players │ ├── ZData.java │ ├── ZDataManager.java │ ├── ZPlayerData.java │ └── inventory │ │ ├── ZInventoriesPlayer.java │ │ └── ZInventoryPlayer.java │ ├── requirement │ ├── ZActionPlayerData.java │ ├── ZConditionalName.java │ ├── ZPermissible.java │ ├── ZRefreshRequirement.java │ ├── ZRequirement.java │ ├── actions │ │ ├── ActionBarAction.java │ │ ├── BackAction.java │ │ ├── BroadcastAction.java │ │ ├── BroadcastSoundAction.java │ │ ├── CloseAction.java │ │ ├── ConnectAction.java │ │ ├── ConsoleCommandAction.java │ │ ├── CurrencyDepositAction.java │ │ ├── CurrencyWithdrawAction.java │ │ ├── DataAction.java │ │ ├── DiscordAction.java │ │ ├── DiscordComponentAction.java │ │ ├── InventoryAction.java │ │ ├── LuckPermissionSet.java │ │ ├── MessageAction.java │ │ ├── OpenBookAction.java │ │ ├── PlayerChatAction.java │ │ ├── PlayerCommandAction.java │ │ ├── RefreshAction.java │ │ ├── ShopkeeperAction.java │ │ ├── SoundAction.java │ │ ├── TeleportAction.java │ │ └── TitleAction.java │ ├── checker │ │ ├── ConfigurationChecker.java │ │ └── InventoryRequirementChecker.java │ └── permissible │ │ ├── ZCurrencyPermissible.java │ │ ├── ZItemPermissible.java │ │ ├── ZJobPermissible.java │ │ ├── ZLuckPermPermissible.java │ │ ├── ZPermissionPermissible.java │ │ ├── ZPlaceholderPermissible.java │ │ ├── ZPlayerNamePermissible.java │ │ └── ZRegexPermissible.java │ ├── save │ ├── Config.java │ └── MessageLoader.java │ ├── scheduler │ ├── BukkitScheduler.java │ └── FoliaScheduler.java │ ├── sound │ └── ZSoundOption.java │ ├── website │ ├── DownloadFile.java │ ├── Folder.java │ ├── Inventory.java │ ├── Resource.java │ ├── Token.java │ ├── ZWebsiteManager.java │ ├── buttons │ │ ├── ButtonBuilderRefresh.java │ │ ├── ButtonFolderBack.java │ │ ├── ButtonFolderNext.java │ │ ├── ButtonFolderPrevious.java │ │ ├── ButtonFolders.java │ │ ├── ButtonInventories.java │ │ ├── ButtonInventoryNext.java │ │ ├── ButtonInventoryPrevious.java │ │ └── ButtonMarketplace.java │ ├── inventories │ │ └── InventoryMarketplace.java │ └── request │ │ ├── HttpRequest.java │ │ └── Response.java │ └── zcore │ ├── ZPlugin.java │ ├── enums │ ├── EnumInventory.java │ ├── Folder.java │ ├── Message.java │ └── Permission.java │ ├── logger │ └── Logger.java │ └── utils │ ├── Banner.java │ ├── Base64.java │ ├── Cuboid.java │ ├── DefaultFontInfo.java │ ├── ElapsedTime.java │ ├── Firework.java │ ├── InventoryArgument.java │ ├── LeatherArmor.java │ ├── LocationUtils.java │ ├── MessageUtils.java │ ├── PapiUtils.java │ ├── PlayerSkin.java │ ├── Potion.java │ ├── ProgressBar.java │ ├── RandomString.java │ ├── SimpleCache.java │ ├── TranslationHelper.java │ ├── ZOpenLink.java │ ├── ZUtils.java │ ├── attribute │ └── AttributeApplier.java │ ├── builder │ ├── CooldownBuilder.java │ ├── ItemBuilder.java │ ├── PotionBuilder.java │ └── TimerBuilder.java │ ├── commands │ ├── Arguments.java │ ├── CollectionBiConsumer.java │ ├── CommandType.java │ └── Tab.java │ ├── discord │ ├── DiscordConfiguration.java │ ├── DiscordConfigurationComponent.java │ ├── DiscordEmbedConfiguration.java │ ├── DiscordWebhook.java │ ├── DiscordWebhookComponent.java │ └── ReturnConsumer.java │ ├── gson │ ├── DataAdapter.java │ ├── LocationAdapter.java │ └── PotionEffectAdapter.java │ ├── interfaces │ ├── CollectionConsumer.java │ ├── ReturnBiConsumer.java │ ├── ReturnConsumer.java │ └── StringConsumer.java │ ├── inventory │ ├── InventoryResult.java │ ├── ItemButton.java │ └── Pagination.java │ ├── itemstack │ ├── MenuItemStackFormMap.java │ └── MenuItemStackFromItemStack.java │ ├── loader │ ├── ItemStackLoader.java │ └── Loader.java │ ├── map │ ├── OptionalHashMap.java │ └── OptionalMap.java │ ├── meta │ ├── ClassicMeta.java │ ├── ComponentMeta.java │ └── Meta.java │ ├── nms │ ├── Base64ItemStack.java │ ├── EnumReflectionCompound.java │ ├── ItemStackCompound.java │ ├── ItemStackUtils.java │ ├── NMSUtils.java │ └── NmsVersion.java │ ├── players │ ├── ActionBar.java │ └── BarApi.java │ ├── plugins │ ├── Metrics.java │ ├── Plugins.java │ └── VersionChecker.java │ ├── storage │ ├── DiscUtils.java │ ├── Persist.java │ └── Savable.java │ └── yaml │ └── YamlUtils.java └── main └── resources ├── commands ├── commands.yml └── punish │ └── punish.yml ├── default_values.yml ├── global-placeholders.yml ├── inventories ├── 1_13 │ ├── advanced_inventory.yml │ ├── basic_inventory.yml │ ├── example_punish.yml │ └── pro_inventory.yml ├── advanced_inventory.yml ├── basic_inventory.yml ├── example_punish.yml └── pro_inventory.yml ├── patterns └── pattern_example.yml ├── plugin.yml ├── readme.txt └── website ├── 1_13 ├── inventories.yml └── marketplace.yml ├── inventories.yml └── marketplace.yml /.github/workflows/maven-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a package using Maven and then publish it to GitHub packages when a release is created 2 | # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path 3 | 4 | name: Maven Package 5 | 6 | on: 7 | push: 8 | branches: 9 | - develop 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | permissions: 16 | contents: read 17 | packages: write 18 | 19 | steps: 20 | - uses: actions/checkout@v3 21 | - name: Set up JDK 8 22 | uses: actions/setup-java@v3 23 | with: 24 | java-version: '8' 25 | distribution: 'temurin' 26 | server-id: github # Value of the distributionManagement/repository/id field of the pom.xml 27 | settings-path: ${{ github.workspace }} # location for the settings.xml file 28 | 29 | - name: Build with Maven 30 | run: mvn -B package --file pom.xml 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Don't track content of these folders 2 | target/ 3 | bin/ 4 | .settings/ 5 | .classpath 6 | .project 7 | .idea 8 | zmenu.iml 9 | libs/nexo-0.5.jar 10 | *.java~ 11 | *.xml~ 12 | changelog.md~ 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # zMenu 2 | 3 | zMenu is a plugin that will allow the creation of inventory using configuration files. The plugin has an API so that any plugins can use the inventory system. 4 | 5 | * Download zMenu: https://groupez.dev/resources/zmenu.253 6 | * Documentation: https://docs.zmenu.dev/ 7 | * JavaDocs: https://javadocs.groupez.dev/zmenu 8 | * Discord: https://discord.groupez.dev/ 9 | * InventoryBuilder: https://minecraft-inventory-builder.com/ 10 | * Sponsor (Serveur Minecraft Vote): https://serveur-minecraft-vote.fr/ 11 | 12 | ![showcase](https://img.groupez.dev/zmenu/showcase.gif)![punish](https://img.groupez.dev/zmenu/punishv2.gif) 13 | ![optionnal arg](https://img.groupez.dev/zmenu/ao.gif)![shop](https://img.groupez.dev/zmenu/shop.gif) 14 | -------------------------------------------------------------------------------- /libs/HMCCosmetics-2.7.7.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maxlego08/zMenu/ae896d6701f99d2b099af8fe14d87b77407f8866/libs/HMCCosmetics-2.7.7.jar -------------------------------------------------------------------------------- /libs/Jobs5.2.2.3.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maxlego08/zMenu/ae896d6701f99d2b099af8fe14d87b77407f8866/libs/Jobs5.2.2.3.jar -------------------------------------------------------------------------------- /libs/zItems-1.0.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Maxlego08/zMenu/ae896d6701f99d2b099af8fe14d87b77407f8866/libs/zItems-1.0.0.jar -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/InventoryListener.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api; 2 | 3 | import fr.maxlego08.menu.inventory.VInventory; 4 | import fr.maxlego08.menu.zcore.utils.inventory.ItemButton; 5 | import org.bukkit.entity.Player; 6 | 7 | public interface InventoryListener { 8 | 9 | default boolean addItem(VInventory inventory, boolean inPlayerInventory, ItemButton itemButton, boolean enableAntiDupe){ 10 | return false; 11 | } 12 | 13 | default void onInventoryPreOpen(Player player, VInventory inventory, int page, Object... objects){ 14 | 15 | } 16 | 17 | default void onInventoryPostOpen(Player player, VInventory inventory){ 18 | 19 | } 20 | 21 | default void onInventoryClose(Player player, VInventory inventory){ 22 | 23 | } 24 | 25 | default void onButtonClick(Player player, ItemButton button){ 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/InventoryOption.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api; 2 | 3 | import fr.maxlego08.menu.inventory.VInventory; 4 | import org.bukkit.configuration.file.YamlConfiguration; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.inventory.ItemStack; 7 | 8 | import java.io.File; 9 | 10 | public interface InventoryOption { 11 | 12 | String getName(); 13 | 14 | void loadInventory(Inventory inventory, File file, YamlConfiguration configuration, InventoryManager inventoryManager, ButtonManager buttonManager); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/attribute/IAttribute.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.attribute; 2 | 3 | import org.bukkit.inventory.EquipmentSlot; 4 | import java.util.UUID; 5 | 6 | /** 7 | * Interface defining attributes for a menu item in Bukkit. 8 | */ 9 | public interface IAttribute { 10 | 11 | /** 12 | * Gets the type of the attribute. 13 | * 14 | * @return the type of the attribute. 15 | */ 16 | Attribute.Type getType(); 17 | 18 | /** 19 | * Gets the UUID of the attribute. 20 | * 21 | * @return the unique UUID of the attribute. 22 | */ 23 | UUID getUuid(); 24 | 25 | /** 26 | * Gets the name of the attribute. 27 | * 28 | * @return the name of the attribute. 29 | */ 30 | String getName(); 31 | 32 | /** 33 | * Gets the amount affected by this attribute. 34 | * 35 | * @return the double amount of the attribute. 36 | */ 37 | double getAmount(); 38 | 39 | /** 40 | * Gets the equipment slot associated with this attribute. 41 | * 42 | * @return the equipment slot ({@link EquipmentSlot}) linked to this attribute. 43 | */ 44 | EquipmentSlot getSlot(); 45 | } 46 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/PaginateButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | public interface PaginateButton extends Button { 6 | 7 | int getPaginationSize(Player player); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/PlaceholderButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button; 2 | 3 | import fr.maxlego08.menu.api.requirement.permissible.PlaceholderPermissible; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * The `PlaceholderButton` interface allows you to perform checks using placeholders. It requires the PlaceholderAPI plugin 9 | * (available at: PlaceholderAPI). 10 | */ 11 | public interface PlaceholderButton { 12 | 13 | /** 14 | * Returns the list of placeholders used in the button. 15 | * 16 | * @return The list of placeholder permissions. 17 | */ 18 | List getPlaceholders(); 19 | 20 | /** 21 | * Checks if the button uses any placeholders. 22 | * 23 | * @return `true` if placeholders are used, otherwise `false`. 24 | */ 25 | boolean hasPlaceHolder(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/SlotButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button; 2 | 3 | import java.util.Collection; 4 | 5 | /** 6 | *

The SlotButton interface allows a single button to occupy multiple slots in an inventory.

7 | */ 8 | public interface SlotButton { 9 | 10 | /** 11 | * Returns the list of slots where the button will be placed. 12 | * 13 | * @return The collection of slots. 14 | */ 15 | Collection getSlots(); 16 | 17 | /** 18 | * Returns the page of the button in the inventory. The page is 19 | * used to determine which elements should be displayed when the 20 | * button is placed in an inventory that supports pagination. 21 | * 22 | * @return The page of the button. 23 | */ 24 | int getPage(); 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/buttons/BackButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.button.Button; 4 | 5 | /** 6 | * Represents a button that allows the user to return to the previous inventory. 7 | * This button typically facilitates navigation within multi-level inventories. 8 | */ 9 | public interface BackButton extends Button { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/buttons/HomeButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button.buttons; 2 | 3 | /** 4 | * Represents a button that allows the user to return to the main inventory, 5 | * typically the first inventory that was opened. 6 | * This button is useful for navigating back to the root of the inventory system. 7 | */ 8 | public interface HomeButton extends BackButton { 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/buttons/NextButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.button.Button; 4 | 5 | /** 6 | * Represents a button within a user interface in a Minecraft plugin that allows the player 7 | * to navigate to the next page of an inventory. This interface extends the basic functionality 8 | * of a Button to specifically handle pagination within inventory GUIs. 9 | *

10 | * The NextButton is designed to facilitate navigation in paginated inventories where content 11 | * exceeds the space available on a single inventory screen. Its behavior is inherently linked 12 | * to the structure of the inventory it is part of, automatically determining if a subsequent page 13 | * is available and enabling the player to move forward in the pagination sequence. 14 | *

15 | *

16 | * Implementations of this interface should handle cases where the current page is the last page 17 | * of the inventory. In such scenarios, the NextButton can either become inactive, disappear, or 18 | * be replaced with an alternative element defined by the "else" condition in the implementation, 19 | * ensuring a seamless and intuitive user experience. 20 | *

21 | */ 22 | public interface NextButton extends Button { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/buttons/NoneButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.button.Button; 4 | 5 | /** 6 | * Represents the default button type in a user interface within a Minecraft plugin, extending 7 | * the basic {@link Button} interface. This button type is used as a fallback option and is 8 | * automatically chosen by the plugin's UI handling system when no specific button type is identified 9 | * for a given UI element. 10 | *

11 | * The NoneButton serves as a generic button with standard behavior, suitable for basic interactions 12 | * where no specialized functionality is required. It provides a baseline implementation that can be 13 | * used to display a clickable item or option within an inventory GUI without attaching any additional 14 | * logic or behavior that is specific to the context of the UI being created. 15 | *

16 | *

17 | * This interface is ideal for simple actions or when you want to introduce a button that adheres to 18 | * the default interaction patterns established by the plugin's UI framework. Implementations might 19 | * include basic navigation, confirmation actions, or triggers for non-complex operations. 20 | *

21 | */ 22 | public interface NoneButton extends Button { 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/button/buttons/PreviousButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.button.Button; 4 | 5 | /** 6 | * Represents a button that allows the player to navigate to the previous page of an inventory. 7 | * If there is no previous page, an alternative button can be displayed using the "else" element. 8 | */ 9 | public interface PreviousButton extends Button { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/checker/InventoryRequirementType.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.checker; 2 | 3 | public enum InventoryRequirementType { 4 | 5 | ACTION, 6 | BUTTON, 7 | PERMISSIBLE, 8 | PATTERN, 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/dupe/DupeItem.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.dupe; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.inventory.ItemStack; 5 | 6 | public class DupeItem { 7 | 8 | private final ItemStack itemStack; 9 | private final Player player; 10 | 11 | public DupeItem(ItemStack itemStack, Player player) { 12 | this.itemStack = itemStack; 13 | this.player = player; 14 | } 15 | 16 | public ItemStack getItemStack() { 17 | return itemStack; 18 | } 19 | 20 | public Player getPlayer() { 21 | return player; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/dupe/DupeManager.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.dupe; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | 5 | public interface DupeManager { 6 | 7 | /** 8 | * the key to determining where the item comes from 9 | */ 10 | String KEY = "ZMENU-ITEM"; 11 | 12 | /** 13 | * protect an item from dupe 14 | * 15 | * @param itemStack 16 | * @return 17 | */ 18 | ItemStack protectItem(ItemStack itemStack); 19 | 20 | /** 21 | * check if an item is a result of a dupe 22 | * 23 | * @param itemStack 24 | * @return 25 | */ 26 | boolean isDupeItem(ItemStack itemStack); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/enchantment/Enchantments.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.enchantment; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | /** 7 | * Interface for managing custom enchantments in the plugin. 8 | * Provides methods to retrieve, register, and list available enchantments. 9 | */ 10 | public interface Enchantments { 11 | 12 | /** 13 | * Retrieves an enchantment by its name. 14 | * 15 | * @param enchantment the name of the enchantment 16 | * @return an {@link Optional} containing the enchantment if found, otherwise empty 17 | */ 18 | Optional getEnchantments(String enchantment); 19 | 20 | /** 21 | * Registers all custom enchantments within the plugin. 22 | */ 23 | void register(); 24 | 25 | /** 26 | * Retrieves a list of all registered enchantments' names. 27 | * 28 | * @return a list of enchantment names 29 | */ 30 | List getEnchantments(); 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/enchantment/MenuEnchantment.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.enchantment; 2 | 3 | import org.bukkit.enchantments.Enchantment; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * Interface representing a custom enchantment in the plugin. 9 | * Provides methods to retrieve the underlying enchantment and its associated aliases. 10 | */ 11 | public interface MenuEnchantment { 12 | 13 | /** 14 | * Retrieves the underlying Bukkit Enchantment associated with this custom enchantment. 15 | * 16 | * @return the {@link Enchantment} associated with this custom enchantment 17 | */ 18 | Enchantment getEnchantment(); 19 | 20 | /** 21 | * Retrieves the list of aliases for this custom enchantment. 22 | * Aliases are alternative names that can be used to refer to the enchantment. 23 | * 24 | * @return a list of aliases for the enchantment 25 | */ 26 | List getAliases(); 27 | } 28 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/enums/ItemVerification.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.enums; 2 | 3 | public enum ItemVerification { 4 | 5 | MODELID, 6 | SIMILAR; 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/enums/MenuItemRarity.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.enums; 2 | 3 | import org.bukkit.inventory.ItemRarity; 4 | 5 | public enum MenuItemRarity { 6 | 7 | COMMON, 8 | UNCOMMON, 9 | RARE, 10 | EPIC; 11 | 12 | public ItemRarity getItemRarity() { 13 | switch (this) { 14 | case COMMON: 15 | return ItemRarity.COMMON; 16 | case UNCOMMON: 17 | return ItemRarity.UNCOMMON; 18 | case RARE: 19 | return ItemRarity.RARE; 20 | case EPIC: 21 | return ItemRarity.EPIC; 22 | } 23 | return ItemRarity.COMMON; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/enums/MessageType.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.enums; 2 | 3 | public enum MessageType { 4 | 5 | ACTION, 6 | TCHAT, 7 | CENTER, 8 | NONE, 9 | TCHAT_AND_ACTION, 10 | WITHOUT_PREFIX, 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/CancelledMenuEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event; 2 | 3 | import org.bukkit.event.Cancellable; 4 | 5 | public class CancelledMenuEvent extends MenuEvent implements Cancellable { 6 | 7 | private boolean cancelled; 8 | 9 | /** 10 | * @return the cancelled 11 | */ 12 | public boolean isCancelled() { 13 | return cancelled; 14 | } 15 | 16 | /** 17 | * @param cancelled the cancelled to set 18 | */ 19 | public void setCancelled(boolean cancelled) { 20 | this.cancelled = cancelled; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/FastEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event; 2 | 3 | import fr.maxlego08.menu.api.event.events.ButtonLoadEvent; 4 | import fr.maxlego08.menu.api.event.events.InventoryLoadEvent; 5 | import fr.maxlego08.menu.api.event.events.PlayerOpenInventoryEvent; 6 | 7 | /** 8 | * Allows you to listen to the events of the plugin without using the Bukkit API, you gain performance 9 | */ 10 | public abstract class FastEvent { 11 | 12 | /** 13 | * Event when a button will be loaded 14 | * 15 | * @param event {@link ButtonLoadEvent} 16 | */ 17 | public void onButtonLoad(ButtonLoadEvent event){ 18 | 19 | } 20 | 21 | /** 22 | * Event when an inventory will be loaded 23 | * 24 | * @param event {@link InventoryLoadEvent} 25 | */ 26 | public void onInventoryLoad(InventoryLoadEvent event){ 27 | 28 | } 29 | 30 | /** 31 | * Event when a player open an inventory 32 | * 33 | * @param event {@link PlayerOpenInventoryEvent} 34 | */ 35 | public void onPlayerOpenInventory(PlayerOpenInventoryEvent event){ 36 | 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/MenuEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.event.Event; 5 | import org.bukkit.event.HandlerList; 6 | 7 | public class MenuEvent extends Event { 8 | 9 | private final static HandlerList handlers = new HandlerList(); 10 | 11 | /** 12 | * 13 | */ 14 | public MenuEvent() { 15 | super(); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | /** 20 | * @param isAsync 21 | */ 22 | public MenuEvent(boolean isAsync) { 23 | super(isAsync); 24 | // TODO Auto-generated constructor stub 25 | } 26 | 27 | public static HandlerList getHandlerList() { 28 | return handlers; 29 | } 30 | 31 | /** 32 | * @return the handlers 33 | */ 34 | public HandlerList getHandlers() { 35 | return handlers; 36 | } 37 | 38 | public void call() { 39 | Bukkit.getPluginManager().callEvent(this); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/events/ButtonLoadEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event.events; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.event.MenuEvent; 6 | import fr.maxlego08.menu.api.loader.ButtonLoader; 7 | import org.bukkit.configuration.file.YamlConfiguration; 8 | 9 | /** 10 | *

Event called when a Button will be loaded

11 | */ 12 | public class ButtonLoadEvent extends MenuEvent { 13 | 14 | private final YamlConfiguration configuration; 15 | private final String path; 16 | private final ButtonManager buttonManager; 17 | private final ButtonLoader buttonLoader; 18 | private final Button button; 19 | 20 | public ButtonLoadEvent(YamlConfiguration configuration, String path, ButtonManager buttonManager, ButtonLoader buttonLoader, Button button) { 21 | this.configuration = configuration; 22 | this.path = path; 23 | this.buttonManager = buttonManager; 24 | this.buttonLoader = buttonLoader; 25 | this.button = button; 26 | } 27 | 28 | public YamlConfiguration getConfiguration() { 29 | return configuration; 30 | } 31 | 32 | public String getPath() { 33 | return path; 34 | } 35 | 36 | public ButtonManager getButtonManager() { 37 | return buttonManager; 38 | } 39 | 40 | public ButtonLoader getButtonLoader() { 41 | return buttonLoader; 42 | } 43 | 44 | public Button getButton() { 45 | return button; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/events/ButtonLoaderRegisterEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event.events; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.InventoryManager; 5 | import fr.maxlego08.menu.api.event.MenuEvent; 6 | import fr.maxlego08.menu.api.loader.ButtonLoader; 7 | import fr.maxlego08.menu.api.pattern.PatternManager; 8 | 9 | /** 10 | *

The event is called when the defaults buttons will be registered

11 | */ 12 | public class ButtonLoaderRegisterEvent extends MenuEvent { 13 | 14 | private final ButtonManager buttonManager; 15 | private final InventoryManager inventoryManager; 16 | private final PatternManager patternManager; 17 | 18 | public ButtonLoaderRegisterEvent(ButtonManager buttonManager, InventoryManager inventoryManager, PatternManager patternManager) { 19 | this.buttonManager = buttonManager; 20 | this.inventoryManager = inventoryManager; 21 | this.patternManager = patternManager; 22 | } 23 | 24 | public InventoryManager getInventoryManager() { 25 | return inventoryManager; 26 | } 27 | 28 | public PatternManager getPatternManager() { 29 | return patternManager; 30 | } 31 | 32 | /** 33 | * @return the buttonManager 34 | */ 35 | public ButtonManager getButtonManager() { 36 | return this.buttonManager; 37 | } 38 | 39 | /** 40 | * Register a ButtonLoader 41 | * 42 | * @param button 43 | */ 44 | public void register(ButtonLoader button) { 45 | this.buttonManager.register(button); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/events/InventoryLoadEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event.events; 2 | 3 | import fr.maxlego08.menu.api.Inventory; 4 | import fr.maxlego08.menu.api.event.MenuEvent; 5 | import org.bukkit.plugin.Plugin; 6 | 7 | import java.io.File; 8 | 9 | public class InventoryLoadEvent extends MenuEvent { 10 | 11 | private final Plugin plugin; 12 | private final File file; 13 | private final Inventory inventory; 14 | 15 | public InventoryLoadEvent(Plugin plugin, File file, Inventory inventory) { 16 | this.plugin = plugin; 17 | this.file = file; 18 | this.inventory = inventory; 19 | } 20 | 21 | public Plugin getPlugin() { 22 | return plugin; 23 | } 24 | 25 | public File getFile() { 26 | return file; 27 | } 28 | 29 | public Inventory getInventory() { 30 | return inventory; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/event/events/PlayerOpenInventoryEvent.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.event.events; 2 | 3 | import fr.maxlego08.menu.api.Inventory; 4 | import fr.maxlego08.menu.api.event.CancelledMenuEvent; 5 | import org.bukkit.entity.Player; 6 | 7 | import java.util.List; 8 | 9 | public class PlayerOpenInventoryEvent extends CancelledMenuEvent { 10 | 11 | private final Player player; 12 | private final Inventory inventory; 13 | private int page; 14 | private List oldInventories; 15 | 16 | public PlayerOpenInventoryEvent(Player player, Inventory inventory, int page, List oldInventories) { 17 | this.player = player; 18 | this.inventory = inventory; 19 | this.page = page; 20 | this.oldInventories = oldInventories; 21 | } 22 | 23 | public Player getPlayer() { 24 | return player; 25 | } 26 | 27 | public Inventory getInventory() { 28 | return inventory; 29 | } 30 | 31 | public int getPage() { 32 | return page; 33 | } 34 | 35 | public void setPage(int page) { 36 | this.page = page; 37 | } 38 | 39 | public List getOldInventories() { 40 | return oldInventories; 41 | } 42 | 43 | public void setOldInventories(List oldInventories) { 44 | this.oldInventories = oldInventories; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/font/FontImage.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.font; 2 | 3 | /** 4 | *

5 | * The {@code FontImage} interface provides the ability to replace color codes 6 | * in a string with a character that represents the color. 7 | *

8 | *

9 | * For example, the string "&4Hello" will be replaced with the character 10 | * representing the color red, followed by the string "Hello". 11 | *

12 | *

13 | * This interface is used to provide a way to replace color codes in a string 14 | * with a character that represents the color, when the string is displayed to 15 | * the user in a GUI. 16 | *

17 | * 18 | * @author Maxlego08 19 | */ 20 | public interface FontImage { 21 | 22 | /** 23 | *

24 | * Replaces the color codes in the given string with the corresponding 25 | * characters. 26 | *

27 | *

28 | * For example, the string "&4Hello" will be replaced with the character 29 | * representing the color red, followed by the string "Hello". 30 | *

31 | * 32 | * @param string The string in which the color codes are to be replaced. 33 | * @return The string with the color codes replaced. 34 | */ 35 | String replace(String string); 36 | 37 | } -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/itemstack/ItemStackSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.itemstack; 2 | 3 | import org.bukkit.inventory.ItemStack; 4 | 5 | /** 6 | * The ItemStackSimilar interface defines methods for comparing ItemStacks in Minecraft. 7 | * It is used to determine if two ItemStacks are similar based on a specific implementation. 8 | */ 9 | public interface ItemStackSimilar { 10 | 11 | /** 12 | * Retrieves the name of the ItemStack comparison implementation. 13 | * This name can be used to identify different comparison strategies. 14 | * 15 | * @return The name of this ItemStack comparison strategy. 16 | */ 17 | String getName(); 18 | 19 | /** 20 | * Compares two ItemStacks to determine if they are similar according to a defined rule. 21 | * This method is used to compare items in specific contexts, such as menus or inventories. 22 | * 23 | * @param itemStackA The first ItemStack to be compared. 24 | * @param itemStackB The second ItemStack to be compared. 25 | * @return true if the two ItemStacks are considered similar, false otherwise. 26 | */ 27 | boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB); 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/itemstack/TrimConfiguration.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.itemstack; 2 | 3 | import org.bukkit.inventory.meta.trim.TrimMaterial; 4 | import org.bukkit.inventory.meta.trim.TrimPattern; 5 | 6 | public class TrimConfiguration { 7 | private boolean enable; 8 | private TrimMaterial material; 9 | private TrimPattern pattern; 10 | 11 | // Constructeur 12 | public TrimConfiguration(boolean enable, TrimMaterial material, TrimPattern pattern) { 13 | this.enable = enable; 14 | this.material = material; 15 | this.pattern = pattern; 16 | } 17 | 18 | // Getters 19 | public boolean isEnable() { 20 | return enable; 21 | } 22 | 23 | public TrimMaterial getMaterial() { 24 | return material; 25 | } 26 | 27 | public TrimPattern getPattern() { 28 | return pattern; 29 | } 30 | 31 | // Setters 32 | public void setEnable(boolean enable) { 33 | this.enable = enable; 34 | } 35 | 36 | public void setMaterial(TrimMaterial material) { 37 | this.material = material; 38 | } 39 | 40 | public void setPattern(TrimPattern pattern) { 41 | this.pattern = pattern; 42 | } 43 | 44 | // toString method 45 | @Override 46 | public String toString() { 47 | return "TrimConfiguration{" + 48 | "enable=" + enable + 49 | ", material=" + material + 50 | ", pattern=" + pattern + 51 | '}'; 52 | } 53 | } -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/loader/ActionLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.loader; 2 | 3 | import fr.maxlego08.menu.api.requirement.Action; 4 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | * A loader for creating instances of {@link Action} based on configuration. 10 | */ 11 | public interface ActionLoader { 12 | 13 | /** 14 | * Gets the key that defines the type of action. 15 | * 16 | * @return The key. 17 | */ 18 | String getKey(); 19 | 20 | /** 21 | * Creates an instance of {@link Action} based on the provided configuration. 22 | * 23 | * @param path The path in the configuration file. 24 | * @param accessor The map accessor containing the configuration elements. 25 | * @param file The file where the configuration is located. 26 | * @return The created {@link Action}. 27 | */ 28 | Action load(String path, TypedMapAccessor accessor, File file); 29 | } 30 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/loader/MaterialLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.loader; 2 | 3 | import org.bukkit.configuration.file.YamlConfiguration; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | /** 8 | * Documentation: here 9 | *

The MaterialLoader interface defines methods for loading an {@link ItemStack} from a configuration.

10 | */ 11 | public interface MaterialLoader { 12 | 13 | /** 14 | * Returns the key used to load the ItemStack. 15 | * 16 | * @return The key. 17 | */ 18 | String getKey(); 19 | 20 | /** 21 | * Loads an ItemStack based on the provided configuration. 22 | * 23 | * @param player The player. 24 | * @param configuration The current configuration. 25 | * @param path The current path. 26 | * @param materialString The material as a String. 27 | * @return The loaded ItemStack. 28 | */ 29 | ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/loader/PermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.loader; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 5 | 6 | import java.io.File; 7 | 8 | /** 9 | *

The PermissibleLoader interface defines methods for loading a {@link Permissible} from a configuration.

10 | */ 11 | public interface PermissibleLoader { 12 | 13 | /** 14 | * Returns the key used to define the type of permissible. 15 | * 16 | * @return The key. 17 | */ 18 | String getKey(); 19 | 20 | /** 21 | * Creates a {@link Permissible} based on the provided configuration. 22 | * 23 | * @param path The path in the configuration file. 24 | * @param accessor The map accessor that contains the configuration elements. 25 | * @param file The file where the configuration is located. 26 | * @return The loaded {@link Permissible}. 27 | */ 28 | Permissible load(String path, TypedMapAccessor accessor, File file); 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/players/Data.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.players; 2 | 3 | /** 4 | *

A data is composed of a key, a string, and a value, an object

5 | */ 6 | public interface Data { 7 | 8 | /** 9 | * The key 10 | * 11 | * @return key 12 | */ 13 | String getKey(); 14 | 15 | /** 16 | * The value that is stored 17 | * 18 | * @return value 19 | */ 20 | Object getValue(); 21 | 22 | /** 23 | * Permet de savoir quand la valeur doit expirer. If the value is 0 then it never exits 24 | * 25 | * @return expired at 26 | */ 27 | long getExpiredAt(); 28 | 29 | /** 30 | * Allows to know if a data is expired 31 | * 32 | * @return boolean 33 | */ 34 | boolean isExpired(); 35 | 36 | void add(int amount); 37 | 38 | void remove(int amount); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/players/DataManager.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.players; 2 | 3 | import fr.maxlego08.menu.zcore.utils.storage.Savable; 4 | 5 | import java.util.Optional; 6 | import java.util.UUID; 7 | 8 | /** 9 | *

Player Data Management

10 | */ 11 | public interface DataManager extends Savable { 12 | 13 | /** 14 | * @param uniqueId Player {@link UUID} 15 | * @return optional 16 | */ 17 | Optional getPlayer(UUID uniqueId); 18 | 19 | /** 20 | * @param uniqueId Player {@link UUID} 21 | * @return PlayerData 22 | */ 23 | PlayerData getOrCreate(UUID uniqueId); 24 | 25 | /** 26 | * @param uniqueId Player {@link UUID} 27 | * @param data New data 28 | */ 29 | void addData(UUID uniqueId, Data data); 30 | 31 | /** 32 | * @param uniqueId Player {@link UUID} 33 | * @param key Data key 34 | * @return Optional 35 | */ 36 | Optional getData(UUID uniqueId, String key); 37 | 38 | /** 39 | * Clear all player's data 40 | */ 41 | void clearAll(); 42 | 43 | /** 44 | * Save auto 45 | */ 46 | void autoSave(); 47 | 48 | /** 49 | * Clear player's data 50 | * 51 | * @param uniqueId Player {@link UUID} 52 | */ 53 | void clearPlayer(UUID uniqueId); 54 | 55 | void loadDefaultValues(); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/players/PlayerData.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.players; 2 | 3 | import java.util.Collection; 4 | import java.util.Optional; 5 | import java.util.UUID; 6 | 7 | /** 8 | *

Player's {@link Data}

9 | */ 10 | public interface PlayerData { 11 | 12 | /** 13 | * Return uuid of player 14 | * 15 | * @return uniqueId 16 | */ 17 | UUID getUniqueId(); 18 | 19 | /** 20 | * Allows to return list of player {@link Data}. Attention you cannot modify the values directly from this collection. 21 | * 22 | * @return collections 23 | */ 24 | Collection getDatas(); 25 | 26 | /** 27 | * Allows you to add a data 28 | * 29 | * @param data New {@link Data} 30 | */ 31 | void addData(Data data); 32 | 33 | /** 34 | * Allows you to delete a data 35 | * 36 | * @param data Old {@link Data} 37 | */ 38 | void removeData(Data data); 39 | 40 | /** 41 | * Allows you to delete a {@link Data} 42 | * 43 | * @param key Data key 44 | */ 45 | void removeData(String key); 46 | 47 | /** 48 | * Check if data exist 49 | * 50 | * @param key Data key 51 | * @return boolean 52 | */ 53 | boolean containsKey(String key); 54 | 55 | /** 56 | * Get data 57 | * 58 | * @param key Data key 59 | * @return optional 60 | */ 61 | Optional getData(String key); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/players/inventory/InventoriesPlayer.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.players.inventory; 2 | 3 | import fr.maxlego08.menu.zcore.utils.storage.Savable; 4 | import org.bukkit.entity.Player; 5 | import org.bukkit.event.Listener; 6 | 7 | import java.util.Optional; 8 | import java.util.UUID; 9 | 10 | /** 11 | *

Management of player inventories

12 | */ 13 | public interface InventoriesPlayer extends Listener, Savable { 14 | 15 | /** 16 | * Saves the player's inventory to be stored 17 | * 18 | * @param player Player 19 | */ 20 | void storeInventory(Player player); 21 | 22 | /** 23 | * Allows giving the inventory back to the player 24 | * 25 | * @param player Player 26 | */ 27 | void giveInventory(Player player); 28 | 29 | /** 30 | * Check if the player has an inventory saved 31 | * 32 | * @param uniqueId Player {@link UUID} 33 | * @return boolean 34 | */ 35 | boolean hasSavedInventory(UUID uniqueId); 36 | 37 | /** 38 | * Retrieve the player's inventory if it exists 39 | * 40 | * @param uniqueId Player {@link UUID} 41 | * @return optional 42 | */ 43 | Optional getPlayerInventory(UUID uniqueId); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/players/inventory/InventoryPlayer.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.players.inventory; 2 | 3 | import org.bukkit.entity.Player; 4 | 5 | /** 6 | *

Player's {@link org.bukkit.inventory.Inventory}

7 | */ 8 | public interface InventoryPlayer { 9 | 10 | /** 11 | * Saves the player's inventory to be stored 12 | * 13 | * @param player The player 14 | */ 15 | void storeInventory(Player player); 16 | 17 | /** 18 | * Allows to give the inventory back to the player 19 | * 20 | * @param player The player 21 | */ 22 | void giveInventory(Player player); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/data/ActionPlayerData.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.data; 2 | 3 | import fr.maxlego08.menu.api.players.Data; 4 | import fr.maxlego08.menu.api.players.DataManager; 5 | import org.bukkit.OfflinePlayer; 6 | import org.bukkit.entity.Player; 7 | 8 | /** 9 | * Represents an action associated with player data. 10 | */ 11 | public interface ActionPlayerData { 12 | 13 | /** 14 | * Gets the unique key for the action. Ensure keys are unique. 15 | * 16 | * @return The key. 17 | */ 18 | String getKey(); 19 | 20 | /** 21 | * Gets the type of action. 22 | * 23 | * @return The {@link ActionPlayerDataType}. 24 | */ 25 | ActionPlayerDataType getType(); 26 | 27 | /** 28 | * Gets the value associated with the action. 29 | * 30 | * @return The value. 31 | */ 32 | Object getValue(); 33 | 34 | /** 35 | * Gets the number of seconds until the data expires. Use 0 for no expiration. 36 | * 37 | * @return The expiration time in seconds. 38 | */ 39 | long getSeconds(); 40 | 41 | /** 42 | * Converts the action into player data. 43 | * 44 | * @return The {@link Data}. 45 | */ 46 | Data toData(OfflinePlayer player); 47 | 48 | /** 49 | * Executes the action when the player clicks. 50 | * 51 | * @param player The player who executes the action. 52 | * @param dataManager The {@link DataManager}. 53 | */ 54 | void execute(Player player, DataManager dataManager); 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/data/ActionPlayerDataType.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.data; 2 | 3 | public enum ActionPlayerDataType { 4 | 5 | SET, 6 | REMOVE, 7 | 8 | ADD, 9 | 10 | SUBTRACT, 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/CurrencyPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | import fr.traqueur.currencies.Currencies; 5 | 6 | import java.math.BigDecimal; 7 | 8 | public interface CurrencyPermissible extends Permissible { 9 | 10 | String getAmount(); 11 | 12 | Currencies getCurrency(); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/ItemPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.MenuItemStack; 4 | import fr.maxlego08.menu.api.requirement.Permissible; 5 | import org.bukkit.Material; 6 | 7 | /** 8 | * Represents a condition where a player is required to have a specific item. 9 | */ 10 | public interface ItemPermissible extends Permissible { 11 | 12 | /** 13 | * Gets the MenuItemStack that the player must have. 14 | * 15 | * @return The required MenuItemStack. 16 | */ 17 | MenuItemStack getMenuItemStack(); 18 | 19 | /** 20 | * Gets the number of items that the player must have at least. Put 0 to not check the amount. 21 | * 22 | * @return The required amount. 23 | */ 24 | int getAmount(); 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/JobPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | 5 | public interface JobPermissible extends Permissible { 6 | 7 | String getJobName(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/LuckpermPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | 5 | public interface LuckpermPermissible extends Permissible { 6 | 7 | String getGroupName(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/PermissionPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | 5 | /** 6 | * Represents a condition where a player is required to have a specific permission. 7 | */ 8 | public interface PermissionPermissible extends Permissible { 9 | 10 | /** 11 | * Gets the permission that the player must have. 12 | * 13 | * @return The required permission. 14 | */ 15 | String getPermission(); 16 | 17 | /** 18 | * Checks if the condition is reversed, meaning the player should not have the specified permission. 19 | * 20 | * @return True if the condition is reversed; otherwise, false. 21 | */ 22 | boolean isReverse(); 23 | } 24 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/PlaceholderPermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.enums.PlaceholderAction; 4 | import fr.maxlego08.menu.api.requirement.Permissible; 5 | 6 | /** 7 | * Represents a condition based on placeholders for permissions. 8 | */ 9 | public interface PlaceholderPermissible extends Permissible { 10 | 11 | /** 12 | * Gets the action to be performed for the placeholder. 13 | * 14 | * @return The {@link PlaceholderAction}. 15 | */ 16 | PlaceholderAction getPlaceholderAction(); 17 | 18 | /** 19 | * Gets the placeholder that will be used for the condition. 20 | * 21 | * @return The placeholder string. 22 | */ 23 | String getPlaceholder(); 24 | 25 | /** 26 | * Gets the value that will be used for the specified action. 27 | * 28 | * @return The value string. 29 | */ 30 | String getValue(); 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/requirement/permissible/PlayerNamePermissible.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.requirement.permissible; 2 | 3 | import fr.maxlego08.menu.api.requirement.Permissible; 4 | 5 | public interface PlayerNamePermissible extends Permissible { 6 | 7 | String getPlayerName(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/sound/SoundOption.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.sound; 2 | 3 | import com.cryptomorin.xseries.XSound; 4 | import org.bukkit.entity.Entity; 5 | 6 | /** 7 | * Allows you to manage a sound 8 | */ 9 | public interface SoundOption { 10 | 11 | /** 12 | * @return sound 13 | */ 14 | XSound getSound(); 15 | 16 | /** 17 | * @return pitch 18 | */ 19 | float getPitch(); 20 | 21 | /** 22 | * @return volume 23 | */ 24 | float getVolume(); 25 | 26 | /** 27 | * @param entity to play the sound 28 | */ 29 | void play(Entity entity); 30 | 31 | boolean isCustom(); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/utils/IMessage.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.utils; 2 | 3 | import fr.maxlego08.menu.api.enums.MessageType; 4 | 5 | import java.util.List; 6 | 7 | public interface IMessage { 8 | 9 | String getMessage(); 10 | 11 | List getMessages(); 12 | 13 | MessageType getType(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/utils/LoreType.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.utils; 2 | 3 | public enum LoreType { 4 | 5 | REPLACE, 6 | APPEND, 7 | PREPEND 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/utils/OpenLink.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.utils; 2 | 3 | import net.md_5.bungee.api.chat.ClickEvent.Action; 4 | import org.bukkit.entity.Player; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

Sends a message and opens a link.

10 | *

For servers that are in 1.17+ it is advisable to use the MiniMessage format

11 | */ 12 | public interface OpenLink { 13 | 14 | /** 15 | * Returns the action that will be performed on the click 16 | * 17 | * @return action 18 | */ 19 | Action getAction(); 20 | 21 | /** 22 | * Returns the message that will be displayed 23 | * 24 | * @return message 25 | */ 26 | String getMessage(); 27 | 28 | /** 29 | * Returns the value to be used for the click 30 | * 31 | * @return string 32 | */ 33 | String getLink(); 34 | 35 | /** 36 | * Returns the value that will be replaced 37 | * 38 | * @return replace 39 | */ 40 | String getReplace(); 41 | 42 | /** 43 | * @return list of string 44 | */ 45 | List getHover(); 46 | 47 | /** 48 | * Allows you to send messages to a player 49 | * 50 | * @param player The players 51 | * @param strings list of messages 52 | */ 53 | void send(Player player, List strings); 54 | 55 | /** 56 | * Allows to know if the object is valid 57 | * 58 | * @return boolean 59 | */ 60 | boolean isValid(); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/utils/OpenWithItem.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.utils; 2 | 3 | import fr.maxlego08.menu.MenuItemStack; 4 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 5 | import org.bukkit.event.block.Action; 6 | import org.bukkit.event.player.PlayerInteractEvent; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | import java.util.List; 10 | 11 | 12 | /** 13 | *

Represents the item that can be interacted with to open a menu.

14 | */ 15 | public class OpenWithItem { 16 | private final MenuItemStack menuItemStack; 17 | private final List actions; 18 | private final ItemStackSimilar itemStackSimilar; 19 | 20 | public OpenWithItem(MenuItemStack menuItemStack, List actions, ItemStackSimilar itemStackSimilar) { 21 | this.menuItemStack = menuItemStack; 22 | this.actions = actions; 23 | this.itemStackSimilar = itemStackSimilar; 24 | } 25 | 26 | public MenuItemStack getItemStack() { 27 | return menuItemStack; 28 | } 29 | 30 | public List getActions() { 31 | return actions; 32 | } 33 | 34 | public boolean shouldTrigger(PlayerInteractEvent event) { 35 | if (event.getItem() == null) { 36 | return false; 37 | } 38 | 39 | if (!this.actions.contains(event.getAction())) { 40 | return false; 41 | } 42 | 43 | ItemStack itemStack = this.menuItemStack.build(event.getPlayer()); 44 | return this.itemStackSimilar.isSimilar(itemStack, event.getItem()); 45 | } 46 | } -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/api/website/WebsiteManager.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.api.website; 2 | 3 | import org.bukkit.command.CommandSender; 4 | import org.bukkit.entity.Player; 5 | 6 | /** 7 | * ToDO 8 | * In dev, dont use that 9 | */ 10 | public interface WebsiteManager { 11 | 12 | /** 13 | * Allows you to connect to the site 14 | * 15 | * @param sender Command sender 16 | * @param token unique token 17 | */ 18 | void login(CommandSender sender, String token); 19 | 20 | /** 21 | * Disconnect to the site 22 | * 23 | * @param sender Command sender 24 | */ 25 | void disconnect(CommandSender sender); 26 | 27 | void openMarketplace(Player player); 28 | 29 | void downloadFromUrl(CommandSender sender, String url, boolean force); 30 | } 31 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/ZSlotButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button; 2 | 3 | import fr.maxlego08.menu.api.button.SlotButton; 4 | import fr.maxlego08.menu.zcore.utils.ZUtils; 5 | 6 | import java.util.Collection; 7 | import java.util.List; 8 | 9 | public abstract class ZSlotButton extends ZUtils implements SlotButton { 10 | 11 | protected List slots; 12 | protected int page; 13 | 14 | @Override 15 | public Collection getSlots() { 16 | return this.slots; 17 | } 18 | 19 | public void setSlots(List slots) { 20 | this.slots = slots; 21 | } 22 | 23 | public void setPage(int page) { 24 | this.page = page; 25 | } 26 | 27 | @Override 28 | public int getPage() { 29 | return page; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/buttons/ZHomeButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.Inventory; 4 | import fr.maxlego08.menu.api.InventoryManager; 5 | import fr.maxlego08.menu.api.button.buttons.HomeButton; 6 | import fr.maxlego08.menu.api.utils.Placeholders; 7 | import fr.maxlego08.menu.inventory.inventories.InventoryDefault; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.event.inventory.InventoryClickEvent; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | public class ZHomeButton extends ZBackButton implements HomeButton { 15 | 16 | public ZHomeButton(InventoryManager inventoryManager) { 17 | super(inventoryManager); 18 | } 19 | 20 | @Override 21 | public void onClick(Player player, InventoryClickEvent event, InventoryDefault inventory, int slot, Placeholders placeholders) { 22 | super.onClick(player, event, inventory, slot, placeholders); 23 | 24 | if (this.inventory == null) { 25 | return; 26 | } 27 | 28 | Inventory toInventory = this.inventory; 29 | this.inventoryManager.openInventory(player, toInventory, 1, new ArrayList<>()); 30 | } 31 | 32 | @Override 33 | public void onInventoryOpen(Player player, InventoryDefault inventory, Placeholders placeholders) { 34 | 35 | List oldInventories = inventory.getOldInventories(); 36 | if (!oldInventories.isEmpty()) { 37 | this.inventory = oldInventories.get(0); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/buttons/ZJumpButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.Inventory; 4 | import fr.maxlego08.menu.api.InventoryManager; 5 | import fr.maxlego08.menu.api.utils.Placeholders; 6 | import fr.maxlego08.menu.inventory.inventories.InventoryDefault; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.event.inventory.InventoryClickEvent; 9 | 10 | import java.util.ArrayList; 11 | 12 | public class ZJumpButton extends ZNextButton { 13 | private final int page; 14 | private final InventoryManager inventoryManager; 15 | 16 | /** 17 | * @param page the real page(start from 0) 18 | * @param inventoryManager the inventory manager 19 | */ 20 | public ZJumpButton(InventoryManager inventoryManager, int page) { 21 | super(inventoryManager); 22 | this.inventoryManager = inventoryManager; 23 | this.page = page; 24 | } 25 | 26 | @Override 27 | public void onClick(Player player, InventoryClickEvent event, InventoryDefault inventory, int slot, Placeholders placeholders) { 28 | super.onClick(player, event, inventory, slot, placeholders); 29 | 30 | Inventory toInventory = inventory.getMenuInventory(); 31 | this.inventoryManager.openInventory(player, toInventory, page, new ArrayList<>()); 32 | } 33 | 34 | @Override 35 | public boolean checkPermission(Player player, InventoryDefault inventory, Placeholders placeholders) { 36 | return this.page != inventory.getPage(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/buttons/ZMainMenuButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.buttons; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.utils.Placeholders; 5 | import fr.maxlego08.menu.inventory.inventories.InventoryDefault; 6 | import fr.maxlego08.menu.save.Config; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.event.inventory.InventoryClickEvent; 9 | 10 | public class ZMainMenuButton extends ZHomeButton { 11 | private final InventoryManager inventoryManager; 12 | 13 | /** 14 | * @param inventoryManager 15 | */ 16 | public ZMainMenuButton(InventoryManager inventoryManager) { 17 | super(inventoryManager); 18 | this.inventoryManager = inventoryManager; 19 | } 20 | 21 | 22 | @Override 23 | public void onClick(Player player, InventoryClickEvent event, InventoryDefault inventory, int slot, Placeholders placeholders) { 24 | super.onClick(player, event, inventory, slot, placeholders); 25 | inventoryManager.openInventory(player, Config.mainMenu); 26 | } 27 | 28 | @Override 29 | public boolean checkPermission(Player player, InventoryDefault inventory, Placeholders placeholders) { 30 | return true; 31 | } 32 | 33 | @Override 34 | public boolean hasPermission() { 35 | return true; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/buttons/ZNoneButton.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.buttons; 2 | 3 | import fr.maxlego08.menu.button.ZButton; 4 | 5 | public class ZNoneButton extends ZButton { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/BackLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.button.buttons.BackButton; 7 | import fr.maxlego08.menu.api.loader.ButtonLoader; 8 | import fr.maxlego08.menu.button.buttons.ZBackButton; 9 | import org.bukkit.configuration.file.YamlConfiguration; 10 | import org.bukkit.plugin.Plugin; 11 | 12 | public class BackLoader implements ButtonLoader { 13 | 14 | private final Plugin plugin; 15 | private final InventoryManager manager; 16 | 17 | /** 18 | * @param plugin 19 | * @param manager 20 | */ 21 | public BackLoader(Plugin plugin, InventoryManager manager) { 22 | super(); 23 | this.plugin = plugin; 24 | this.manager = manager; 25 | } 26 | 27 | @Override 28 | public Class getButton() { 29 | return BackButton.class; 30 | } 31 | 32 | @Override 33 | public String getName() { 34 | return "back"; 35 | } 36 | 37 | @Override 38 | public Plugin getPlugin() { 39 | return this.plugin; 40 | } 41 | 42 | @Override 43 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 44 | return new ZBackButton(this.manager); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/HomeLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.button.buttons.HomeButton; 7 | import fr.maxlego08.menu.api.loader.ButtonLoader; 8 | import fr.maxlego08.menu.button.buttons.ZHomeButton; 9 | import org.bukkit.configuration.file.YamlConfiguration; 10 | import org.bukkit.plugin.Plugin; 11 | 12 | public class HomeLoader implements ButtonLoader { 13 | 14 | private final Plugin plugin; 15 | private final InventoryManager manager; 16 | 17 | /** 18 | * @param plugin 19 | * @param manager 20 | */ 21 | public HomeLoader(Plugin plugin, InventoryManager manager) { 22 | super(); 23 | this.plugin = plugin; 24 | this.manager = manager; 25 | } 26 | 27 | @Override 28 | public Class getButton() { 29 | return HomeButton.class; 30 | } 31 | 32 | @Override 33 | public String getName() { 34 | return "home"; 35 | } 36 | 37 | @Override 38 | public Plugin getPlugin() { 39 | return this.plugin; 40 | } 41 | 42 | @Override 43 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 44 | return new ZHomeButton(this.manager); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/JumpLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.loader.ButtonLoader; 7 | import fr.maxlego08.menu.button.buttons.ZJumpButton; 8 | import org.bukkit.configuration.file.YamlConfiguration; 9 | import org.bukkit.plugin.Plugin; 10 | 11 | public class JumpLoader implements ButtonLoader { 12 | private final Plugin plugin; 13 | private final InventoryManager inventoryManager; 14 | 15 | public JumpLoader(Plugin plugin, InventoryManager inventoryManager) { 16 | this.plugin = plugin; 17 | this.inventoryManager = inventoryManager; 18 | } 19 | 20 | @Override 21 | public Class getButton() { 22 | return ZJumpButton.class; 23 | } 24 | 25 | @Override 26 | public String getName() { 27 | return "jump"; 28 | } 29 | 30 | @Override 31 | public Plugin getPlugin() { 32 | return this.plugin; 33 | } 34 | 35 | @Override 36 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 37 | int page = configuration.getInt(path + "toPage", configuration.getInt(path + "to-page")); 38 | return new ZJumpButton(this.inventoryManager, page); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/MainMenuLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.loader.ButtonLoader; 7 | import fr.maxlego08.menu.button.buttons.ZMainMenuButton; 8 | import org.bukkit.configuration.file.YamlConfiguration; 9 | import org.bukkit.plugin.Plugin; 10 | 11 | public class MainMenuLoader implements ButtonLoader { 12 | private final Plugin plugin; 13 | private final InventoryManager manager; 14 | 15 | public MainMenuLoader(Plugin plugin, InventoryManager manager) { 16 | super(); 17 | this.plugin = plugin; 18 | this.manager = manager; 19 | } 20 | 21 | @Override 22 | public Class getButton() { 23 | return ZMainMenuButton.class; 24 | } 25 | 26 | @Override 27 | public String getName() { 28 | return "mainmenu"; 29 | } 30 | 31 | @Override 32 | public Plugin getPlugin() { 33 | return this.plugin; 34 | } 35 | 36 | @Override 37 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 38 | return new ZMainMenuButton(manager); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/NextLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.button.buttons.NextButton; 7 | import fr.maxlego08.menu.api.loader.ButtonLoader; 8 | import fr.maxlego08.menu.button.buttons.ZNextButton; 9 | import org.bukkit.configuration.file.YamlConfiguration; 10 | import org.bukkit.plugin.Plugin; 11 | 12 | public class NextLoader implements ButtonLoader { 13 | 14 | private final Plugin plugin; 15 | private final InventoryManager manager; 16 | 17 | /** 18 | * @param plugin 19 | * @param manager 20 | */ 21 | public NextLoader(Plugin plugin, InventoryManager manager) { 22 | super(); 23 | this.plugin = plugin; 24 | this.manager = manager; 25 | } 26 | 27 | @Override 28 | public Class getButton() { 29 | return NextButton.class; 30 | } 31 | 32 | @Override 33 | public String getName() { 34 | return "next"; 35 | } 36 | 37 | @Override 38 | public Plugin getPlugin() { 39 | return this.plugin; 40 | } 41 | 42 | @Override 43 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 44 | defaultButtonValue.setPermanent(true); 45 | return new ZNextButton(this.manager); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/button/loader/PreviousLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.button.loader; 2 | 3 | import fr.maxlego08.menu.api.InventoryManager; 4 | import fr.maxlego08.menu.api.button.Button; 5 | import fr.maxlego08.menu.api.button.DefaultButtonValue; 6 | import fr.maxlego08.menu.api.button.buttons.PreviousButton; 7 | import fr.maxlego08.menu.api.loader.ButtonLoader; 8 | import fr.maxlego08.menu.button.buttons.ZPreviousButton; 9 | import org.bukkit.configuration.file.YamlConfiguration; 10 | import org.bukkit.plugin.Plugin; 11 | 12 | public class PreviousLoader implements ButtonLoader { 13 | 14 | private final Plugin plugin; 15 | private final InventoryManager manager; 16 | 17 | /** 18 | * @param plugin 19 | * @param manager 20 | */ 21 | public PreviousLoader(Plugin plugin, InventoryManager manager) { 22 | super(); 23 | this.plugin = plugin; 24 | this.manager = manager; 25 | } 26 | 27 | @Override 28 | public Class getButton() { 29 | return PreviousButton.class; 30 | } 31 | 32 | @Override 33 | public String getName() { 34 | return "previous"; 35 | } 36 | 37 | @Override 38 | public Plugin getPlugin() { 39 | return this.plugin; 40 | } 41 | 42 | @Override 43 | public Button load(YamlConfiguration configuration, String path, DefaultButtonValue defaultButtonValue) { 44 | defaultButtonValue.setPermanent(true); 45 | return new ZPreviousButton(this.manager); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/CommandMenuDocumentation.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuDocumentation extends VCommand { 10 | 11 | public CommandMenuDocumentation(MenuPlugin plugin) { 12 | super(plugin); 13 | this.addSubCommand("documentation"); 14 | this.setPermission(Permission.ZMENU_DOCUMENTATION); 15 | this.setDescription(Message.DESCRIPTION_DOCUMENTATION); 16 | this.addOptionalArg("word"); 17 | } 18 | 19 | @Override 20 | protected CommandType perform(MenuPlugin plugin) { 21 | 22 | String word = this.argAsString(0, null); 23 | if (word == null) { 24 | message(sender, Message.DOCUMENTATION_INFORMATION_LINK, "%link%", "https://docs.zmenu.dev/"); 25 | } else { 26 | message(sender, Message.DOCUMENTATION_INFORMATION_LINK, "%link%", "https://docs.zmenu.dev/?q=" + word); 27 | } 28 | 29 | return CommandType.SUCCESS; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/CommandMenuEditor.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuEditor extends VCommand { 10 | 11 | public CommandMenuEditor(MenuPlugin plugin) { 12 | super(plugin); 13 | this.addSubCommand("editor"); 14 | this.setDescription(Message.DESCRIPTION_EDITOR); 15 | } 16 | 17 | @Override 18 | protected CommandType perform(MenuPlugin plugin) { 19 | 20 | message(this.sender, "§fhttps://minecraft-inventory-builder.com/builder/"); 21 | 22 | return CommandType.SUCCESS; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/CommandMenuList.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuList extends VCommand { 10 | 11 | public CommandMenuList(MenuPlugin plugin) { 12 | super(plugin); 13 | this.setPermission(Permission.ZMENU_LIST); 14 | this.setDescription(Message.DESCRIPTION_LIST); 15 | this.addSubCommand("list", "l"); 16 | } 17 | 18 | @Override 19 | protected CommandType perform(MenuPlugin plugin) { 20 | plugin.getInventoryManager().sendInventories(this.sender); 21 | return CommandType.SUCCESS; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/CommandMenuTestDupe.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | import org.bukkit.Material; 9 | import org.bukkit.inventory.ItemStack; 10 | 11 | import java.util.Arrays; 12 | 13 | public class CommandMenuTestDupe extends VCommand { 14 | 15 | public CommandMenuTestDupe(MenuPlugin plugin) { 16 | super(plugin); 17 | this.setPermission(Permission.ZMENU_TEST_DUPE); 18 | this.setDescription(Message.DESCRIPTION_TEST_DUPE); 19 | this.addSubCommand("testdupe"); 20 | this.addRequireArg("type", (a, b) -> Arrays.asList("inventory", "item")); 21 | } 22 | 23 | @Override 24 | protected CommandType perform(MenuPlugin plugin) { 25 | 26 | String arg = this.argAsString(0); 27 | 28 | ItemStack itemStack = new ItemStack(Material.STONE); 29 | itemStack = plugin.getDupeManager().protectItem(itemStack); 30 | 31 | if (arg.equalsIgnoreCase("inventory")) { 32 | player.getInventory().addItem(itemStack.clone()); 33 | } else if (arg.equalsIgnoreCase("item")) { 34 | player.getWorld().dropItem(player.getLocation(), itemStack.clone()); 35 | } else return CommandType.SYNTAX_ERROR; 36 | 37 | return CommandType.SUCCESS; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/CommandMenuVersion.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 7 | 8 | public class CommandMenuVersion extends VCommand { 9 | 10 | public CommandMenuVersion(MenuPlugin plugin) { 11 | super(plugin); 12 | this.setDescription(Message.DESCRIPTION_VERSION); 13 | this.addSubCommand("version", "v", "ver"); 14 | } 15 | 16 | @Override 17 | protected CommandType perform(MenuPlugin plugin) { 18 | 19 | message(sender, "§aVersion du plugin§7: §2" + plugin.getDescription().getVersion()); 20 | message(sender, "§aAuteur§7: §2Maxlego08"); 21 | message(sender, "§aMarketplace/Inventory builder§7: §2https://minecraft-inventory-builder.com/"); 22 | message(sender, "§aDiscord§7: §2http://discord.groupez.dev/"); 23 | message(sender, "§aDownload here§7: §2https://groupez.dev/resources/253"); 24 | message(sender, "§aSponsor§7: §chttps://serveur-minecraft-vote.fr/?ref=345"); 25 | 26 | return CommandType.SUCCESS; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/players/CommandMenuPlayers.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.players; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuPlayers extends VCommand { 10 | 11 | public CommandMenuPlayers(MenuPlugin plugin) { 12 | super(plugin); 13 | this.setPermission(Permission.ZMENU_PLAYERS); 14 | this.setDescription(Message.DESCRIPTION_PLAYERS); 15 | this.addSubCommand("players"); 16 | this.addSubCommand(new CommandMenuPlayersSet(plugin)); 17 | this.addSubCommand(new CommandMenuPlayersGet(plugin)); 18 | this.addSubCommand(new CommandMenuPlayersRemove(plugin)); 19 | this.addSubCommand(new CommandMenuPlayersKeys(plugin)); 20 | this.addSubCommand(new CommandMenuPlayersClearAll(plugin)); 21 | this.addSubCommand(new CommandMenuPlayersClearPlayer(plugin)); 22 | this.addSubCommand(new CommandMenuPlayersSubtract(plugin)); 23 | this.addSubCommand(new CommandMenuPlayersAdd(plugin)); 24 | } 25 | 26 | @Override 27 | protected CommandType perform(MenuPlugin plugin) { 28 | sendSyntax(); 29 | return CommandType.SUCCESS; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/players/CommandMenuPlayersClearAll.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.players; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.players.DataManager; 5 | import fr.maxlego08.menu.command.VCommand; 6 | import fr.maxlego08.menu.zcore.enums.Message; 7 | import fr.maxlego08.menu.zcore.enums.Permission; 8 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 9 | 10 | public class CommandMenuPlayersClearAll extends VCommand { 11 | 12 | public CommandMenuPlayersClearAll(MenuPlugin plugin) { 13 | super(plugin); 14 | this.setPermission(Permission.ZMENU_PLAYERS); 15 | this.setDescription(Message.DESCRIPTION_PLAYERS_CLEAR_ALL); 16 | this.addSubCommand("clearall"); 17 | } 18 | 19 | @Override 20 | protected CommandType perform(MenuPlugin plugin) { 21 | 22 | DataManager dataManager = plugin.getDataManager(); 23 | dataManager.clearAll(); 24 | 25 | message(this.sender, Message.PLAYERS_DATA_CLEAR_ALL); 26 | 27 | return CommandType.SUCCESS; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/players/CommandMenuPlayersClearPlayer.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.players; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.players.DataManager; 5 | import fr.maxlego08.menu.command.VCommand; 6 | import fr.maxlego08.menu.zcore.enums.Message; 7 | import fr.maxlego08.menu.zcore.enums.Permission; 8 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 9 | import org.bukkit.OfflinePlayer; 10 | 11 | public class CommandMenuPlayersClearPlayer extends VCommand { 12 | 13 | public CommandMenuPlayersClearPlayer(MenuPlugin plugin) { 14 | super(plugin); 15 | this.setPermission(Permission.ZMENU_PLAYERS); 16 | this.setDescription(Message.DESCRIPTION_PLAYERS_CLEAR_PLAYER); 17 | this.addSubCommand("clear"); 18 | this.addRequireArg("player"); 19 | } 20 | 21 | @Override 22 | protected CommandType perform(MenuPlugin plugin) { 23 | 24 | DataManager dataManager = plugin.getDataManager(); 25 | OfflinePlayer offlinePlayer = this.argAsOfflinePlayer(0); 26 | 27 | dataManager.clearPlayer(offlinePlayer.getUniqueId()); 28 | 29 | message(this.sender, Message.PLAYERS_DATA_CLEAR_PLAYER, "%player%", offlinePlayer.getName()); 30 | 31 | return CommandType.SUCCESS; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/reload/CommandMenuReloadConfig.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.reload; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.save.Config; 6 | import fr.maxlego08.menu.zcore.enums.Message; 7 | import fr.maxlego08.menu.zcore.enums.Permission; 8 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 9 | 10 | public class CommandMenuReloadConfig extends VCommand { 11 | 12 | public CommandMenuReloadConfig(MenuPlugin plugin) { 13 | super(plugin); 14 | this.addSubCommand("config"); 15 | this.setPermission(Permission.ZMENU_RELOAD); 16 | } 17 | 18 | @Override 19 | protected CommandType perform(MenuPlugin plugin) { 20 | 21 | plugin.getMessageLoader().load(); 22 | Config.getInstance().load(plugin.getPersist()); 23 | 24 | plugin.getPatternManager().loadPatterns(); 25 | 26 | message(this.sender, Message.RELOAD_FILES); 27 | 28 | return CommandType.SUCCESS; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/website/CommandMenuDisconnect.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.website; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.website.WebsiteManager; 5 | import fr.maxlego08.menu.command.VCommand; 6 | import fr.maxlego08.menu.zcore.enums.Message; 7 | import fr.maxlego08.menu.zcore.enums.Permission; 8 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 9 | 10 | public class CommandMenuDisconnect extends VCommand { 11 | 12 | public CommandMenuDisconnect(MenuPlugin plugin) { 13 | super(plugin); 14 | this.setDescription(Message.DESCRIPTION_DISCONNECT); 15 | this.addSubCommand("disconnect", "logout"); 16 | this.setPermission(Permission.ZMENU_DESCRIPTION); 17 | } 18 | 19 | @Override 20 | protected CommandType perform(MenuPlugin plugin) { 21 | 22 | WebsiteManager manager = plugin.getWebsiteManager(); 23 | manager.disconnect(this.sender); 24 | 25 | return CommandType.SUCCESS; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/website/CommandMenuInventories.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.website; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuInventories extends VCommand { 10 | 11 | public CommandMenuInventories(MenuPlugin plugin) { 12 | super(plugin); 13 | this.setDescription(Message.DESCRIPTION_INVENTORIES); 14 | this.addSubCommand("inventories"); 15 | this.setPermission(Permission.ZMENU_INVENTORIES); 16 | this.setConsoleCanUse(false); 17 | } 18 | 19 | @Override 20 | protected CommandType perform(MenuPlugin plugin) { 21 | 22 | plugin.getWebsiteManager().fetchInventories(this.player); 23 | return CommandType.SUCCESS; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/website/CommandMenuLogin.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.website; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.website.WebsiteManager; 5 | import fr.maxlego08.menu.command.VCommand; 6 | import fr.maxlego08.menu.zcore.enums.Message; 7 | import fr.maxlego08.menu.zcore.enums.Permission; 8 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 9 | 10 | public class CommandMenuLogin extends VCommand { 11 | 12 | public CommandMenuLogin(MenuPlugin plugin) { 13 | super(plugin); 14 | this.setDescription(Message.DESCRIPTION_LOGIN); 15 | this.addSubCommand("login"); 16 | this.setPermission(Permission.ZMENU_LOGIN); 17 | this.addRequireArg("token"); 18 | } 19 | 20 | @Override 21 | protected CommandType perform(MenuPlugin plugin) { 22 | 23 | String token = this.argAsString(0); 24 | 25 | WebsiteManager manager = plugin.getWebsiteManager(); 26 | manager.login(this.sender, token); 27 | 28 | return CommandType.SUCCESS; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/command/commands/website/CommandMenuMarketplace.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.command.commands.website; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.command.VCommand; 5 | import fr.maxlego08.menu.zcore.enums.Message; 6 | import fr.maxlego08.menu.zcore.enums.Permission; 7 | import fr.maxlego08.menu.zcore.utils.commands.CommandType; 8 | 9 | public class CommandMenuMarketplace extends VCommand { 10 | 11 | public CommandMenuMarketplace(MenuPlugin plugin) { 12 | super(plugin); 13 | this.setDescription(Message.DESCRIPTION_MARKETPLACE); 14 | this.addSubCommand("marketplace", "market", "shop"); 15 | this.setPermission(Permission.ZMENU_MARKETPLACE); 16 | this.setConsoleCanUse(false); 17 | } 18 | 19 | @Override 20 | protected CommandType perform(MenuPlugin plugin) { 21 | 22 | plugin.getWebsiteManager().openMarketplace(this.player); 23 | return CommandType.SUCCESS; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/dupe/NMSDupeManager.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.dupe; 2 | 3 | import fr.maxlego08.menu.api.dupe.DupeManager; 4 | import fr.maxlego08.menu.zcore.utils.nms.ItemStackCompound; 5 | import org.bukkit.inventory.ItemStack; 6 | 7 | public class NMSDupeManager implements DupeManager { 8 | 9 | @Override 10 | public ItemStack protectItem(ItemStack itemStack) { 11 | return ItemStackCompound.itemStackCompound.setBoolean(itemStack, DupeManager.KEY, true); 12 | } 13 | 14 | @Override 15 | public boolean isDupeItem(ItemStack itemStack) { 16 | return ItemStackCompound.itemStackCompound.isKey(itemStack, DupeManager.KEY); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/enchantment/ZMenuEnchantment.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.enchantment; 2 | 3 | import fr.maxlego08.menu.api.enchantment.MenuEnchantment; 4 | import org.bukkit.enchantments.Enchantment; 5 | 6 | import java.util.List; 7 | 8 | public class ZMenuEnchantment implements MenuEnchantment { 9 | 10 | private final Enchantment enchantment; 11 | private final List aliases; 12 | 13 | public ZMenuEnchantment(Enchantment enchantment, List aliases) { 14 | this.enchantment = enchantment; 15 | this.aliases = aliases; 16 | } 17 | 18 | public Enchantment getEnchantment() { 19 | return enchantment; 20 | } 21 | 22 | public List getAliases() { 23 | return aliases; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/ButtonAlreadyRegisterException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class ButtonAlreadyRegisterException extends Error { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -2426306444018640211L; 9 | 10 | /** 11 | * 12 | */ 13 | public ButtonAlreadyRegisterException() { 14 | super(); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | /** 19 | * @param message 20 | * @param cause 21 | * @param enableSuppression 22 | * @param writableStackTrace 23 | */ 24 | public ButtonAlreadyRegisterException(String message, Throwable cause, boolean enableSuppression, 25 | boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @param message 32 | * @param cause 33 | */ 34 | public ButtonAlreadyRegisterException(String message, Throwable cause) { 35 | super(message, cause); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public ButtonAlreadyRegisterException(String message) { 43 | super(message); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param cause 49 | */ 50 | public ButtonAlreadyRegisterException(Throwable cause) { 51 | super(cause); 52 | // TODO Auto-generated constructor stub 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryAlreadyExistException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryAlreadyExistException extends Error { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -5611455794293458580L; 9 | 10 | public InventoryAlreadyExistException() { 11 | super(); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public InventoryAlreadyExistException(String message, Throwable cause, boolean enableSuppression, 16 | boolean writableStackTrace) { 17 | super(message, cause, enableSuppression, writableStackTrace); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | public InventoryAlreadyExistException(String message, Throwable cause) { 22 | super(message, cause); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | public InventoryAlreadyExistException(String message) { 27 | super(message); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | public InventoryAlreadyExistException(Throwable cause) { 32 | super(cause); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryButtonException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryButtonException extends InventoryException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -8733148642557198564L; 9 | 10 | /** 11 | * 12 | */ 13 | public InventoryButtonException() { 14 | super(); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | /** 19 | * @param message 20 | * @param cause 21 | * @param enableSuppression 22 | * @param writableStackTrace 23 | */ 24 | public InventoryButtonException(String message, Throwable cause, boolean enableSuppression, 25 | boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @param message 32 | * @param cause 33 | */ 34 | public InventoryButtonException(String message, Throwable cause) { 35 | super(message, cause); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public InventoryButtonException(String message) { 43 | super(message); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param cause 49 | */ 50 | public InventoryButtonException(Throwable cause) { 51 | super(cause); 52 | // TODO Auto-generated constructor stub 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryException extends Exception { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 2498115281127927055L; 9 | 10 | public InventoryException() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public InventoryException(String message) { 15 | super(message); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | public InventoryException(Throwable cause) { 20 | super(cause); 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | public InventoryException(String message, Throwable cause) { 25 | super(message, cause); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | public InventoryException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 30 | super(message, cause, enableSuppression, writableStackTrace); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryFileNotFound.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryFileNotFound extends InventoryException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 5794114572465101305L; 9 | 10 | /** 11 | * 12 | */ 13 | public InventoryFileNotFound() { 14 | super(); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | /** 19 | * @param message 20 | * @param cause 21 | * @param enableSuppression 22 | * @param writableStackTrace 23 | */ 24 | public InventoryFileNotFound(String message, Throwable cause, boolean enableSuppression, 25 | boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @param message 32 | * @param cause 33 | */ 34 | public InventoryFileNotFound(String message, Throwable cause) { 35 | super(message, cause); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public InventoryFileNotFound(String message) { 43 | super(message); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param cause 49 | */ 50 | public InventoryFileNotFound(Throwable cause) { 51 | super(cause); 52 | // TODO Auto-generated constructor stub 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryOpenException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryOpenException extends Exception { 4 | 5 | 6 | private static final long serialVersionUID = 1L; 7 | 8 | public InventoryOpenException() { 9 | super(); 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public InventoryOpenException(String message, Throwable cause, boolean enableSuppression, 14 | boolean writableStackTrace) { 15 | super(message, cause, enableSuppression, writableStackTrace); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | public InventoryOpenException(String message, Throwable cause) { 20 | super(message, cause); 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | public InventoryOpenException(String message) { 25 | super(message); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | public InventoryOpenException(Throwable cause) { 30 | super(cause); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventorySizeException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventorySizeException extends InventoryException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 8685275095501686794L; 9 | 10 | /** 11 | * 12 | */ 13 | public InventorySizeException() { 14 | super(); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | /** 19 | * @param message 20 | * @param cause 21 | * @param enableSuppression 22 | * @param writableStackTrace 23 | */ 24 | public InventorySizeException(String message, Throwable cause, boolean enableSuppression, 25 | boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @param message 32 | * @param cause 33 | */ 34 | public InventorySizeException(String message, Throwable cause) { 35 | super(message, cause); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public InventorySizeException(String message) { 43 | super(message); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param cause 49 | */ 50 | public InventorySizeException(Throwable cause) { 51 | super(cause); 52 | // TODO Auto-generated constructor stub 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/InventoryTypeException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class InventoryTypeException extends InventoryException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | /** 11 | * 12 | */ 13 | public InventoryTypeException() { 14 | super(); 15 | // TODO Auto-generated constructor stub 16 | } 17 | 18 | /** 19 | * @param message 20 | * @param cause 21 | * @param enableSuppression 22 | * @param writableStackTrace 23 | */ 24 | public InventoryTypeException(String message, Throwable cause, boolean enableSuppression, 25 | boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | /** 31 | * @param message 32 | * @param cause 33 | */ 34 | public InventoryTypeException(String message, Throwable cause) { 35 | super(message, cause); 36 | // TODO Auto-generated constructor stub 37 | } 38 | 39 | /** 40 | * @param message 41 | */ 42 | public InventoryTypeException(String message) { 43 | super(message); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | /** 48 | * @param cause 49 | */ 50 | public InventoryTypeException(Throwable cause) { 51 | super(cause); 52 | // TODO Auto-generated constructor stub 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/ItemCreateException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class ItemCreateException extends Error { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public ItemCreateException() { 11 | super(); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public ItemCreateException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 16 | super(message, cause, enableSuppression, writableStackTrace); 17 | // TODO Auto-generated constructor stub 18 | } 19 | 20 | public ItemCreateException(String message, Throwable cause) { 21 | super(message, cause); 22 | // TODO Auto-generated constructor stub 23 | } 24 | 25 | public ItemCreateException(String message) { 26 | super(message); 27 | // TODO Auto-generated constructor stub 28 | } 29 | 30 | public ItemCreateException(Throwable cause) { 31 | super(cause); 32 | // TODO Auto-generated constructor stub 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/ItemEnchantException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package fr.maxlego08.menu.exceptions; 5 | 6 | /** 7 | * @author Maxlego08 8 | * 9 | */ 10 | public class ItemEnchantException extends Exception { 11 | 12 | /** 13 | * 14 | */ 15 | private static final long serialVersionUID = 1L; 16 | 17 | /** 18 | * 19 | */ 20 | public ItemEnchantException() { 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | /** 25 | * @param message 26 | */ 27 | public ItemEnchantException(String message) { 28 | super(message); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | /** 33 | * @param cause 34 | */ 35 | public ItemEnchantException(Throwable cause) { 36 | super(cause); 37 | // TODO Auto-generated constructor stub 38 | } 39 | 40 | /** 41 | * @param message 42 | * @param cause 43 | */ 44 | public ItemEnchantException(String message, Throwable cause) { 45 | super(message, cause); 46 | // TODO Auto-generated constructor stub 47 | } 48 | 49 | /** 50 | * @param message 51 | * @param cause 52 | * @param enableSuppression 53 | * @param writableStackTrace 54 | */ 55 | public ItemEnchantException(String message, Throwable cause, boolean enableSuppression, 56 | boolean writableStackTrace) { 57 | super(message, cause, enableSuppression, writableStackTrace); 58 | // TODO Auto-generated constructor stub 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/ItemFlagException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class ItemFlagException extends Exception { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public ItemFlagException() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public ItemFlagException(String message) { 15 | super(message); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | public ItemFlagException(Throwable cause) { 20 | super(cause); 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | public ItemFlagException(String message, Throwable cause) { 25 | super(message, cause); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | public ItemFlagException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 30 | super(message, cause, enableSuppression, writableStackTrace); 31 | // TODO Auto-generated constructor stub 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/exceptions/ListenerNullException.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.exceptions; 2 | 3 | public class ListenerNullException extends Error { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public ListenerNullException() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | public ListenerNullException(String message) { 15 | super(message); 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | public ListenerNullException(Throwable cause) { 20 | super(cause); 21 | // TODO Auto-generated constructor stub 22 | } 23 | 24 | public ListenerNullException(String message, Throwable cause) { 25 | super(message, cause); 26 | // TODO Auto-generated constructor stub 27 | } 28 | 29 | public ListenerNullException(String message, Throwable cause, boolean enableSuppression, 30 | boolean writableStackTrace) { 31 | super(message, cause, enableSuppression, writableStackTrace); 32 | // TODO Auto-generated constructor stub 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/font/EmptyFont.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.font; 2 | 3 | import fr.maxlego08.menu.api.font.FontImage; 4 | 5 | public class EmptyFont implements FontImage { 6 | 7 | @Override 8 | public String replace(String string) { 9 | return string; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/font/ItemsAdderFont.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.font; 2 | 3 | import dev.lone.itemsadder.api.FontImages.FontImageWrapper; 4 | import fr.maxlego08.menu.api.font.FontImage; 5 | 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | public class ItemsAdderFont implements FontImage { 10 | 11 | private final Pattern pattern = Pattern.compile(":(\\w+):"); 12 | 13 | @Override 14 | public String replace(String string) { 15 | Matcher matcher = pattern.matcher(string); 16 | StringBuffer result = new StringBuffer(); 17 | while (matcher.find()) { 18 | String replacement = FontImageWrapper.replaceFontImages(matcher.group(0)); 19 | matcher.appendReplacement(result, replacement); 20 | } 21 | matcher.appendTail(result); 22 | return result.toString(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/itemstack/FullSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.itemstack; 2 | 3 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 4 | import org.bukkit.inventory.ItemStack; 5 | 6 | public class FullSimilar implements ItemStackSimilar { 7 | @Override 8 | public String getName() { 9 | return "full"; 10 | } 11 | 12 | @Override 13 | public boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB) { 14 | if (itemStackA == null || itemStackB == null) return false; 15 | return itemStackA.isSimilar(itemStackB); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/itemstack/LoreSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.itemstack; 2 | 3 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 4 | import org.bukkit.inventory.ItemStack; 5 | import org.bukkit.inventory.meta.ItemMeta; 6 | 7 | import java.util.Objects; 8 | 9 | public class LoreSimilar implements ItemStackSimilar { 10 | @Override 11 | public String getName() { 12 | return "lore"; 13 | } 14 | 15 | @Override 16 | public boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB) { 17 | if (itemStackA == null || itemStackB == null) return false; 18 | ItemMeta metaA = itemStackA.getItemMeta(); 19 | ItemMeta metaB = itemStackB.getItemMeta(); 20 | if (metaA == null || metaB == null) return false; 21 | return metaA.hasLore() && metaB.hasLore() && Objects.equals(metaA.getLore(), metaB.getLore()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/itemstack/MaterialSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.itemstack; 2 | 3 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 4 | import org.bukkit.inventory.ItemStack; 5 | 6 | public class MaterialSimilar implements ItemStackSimilar { 7 | @Override 8 | public String getName() { 9 | return "material"; 10 | } 11 | 12 | @Override 13 | public boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB) { 14 | return itemStackA.getType() == itemStackB.getType(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/itemstack/ModelIdSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.itemstack; 2 | 3 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 4 | import org.bukkit.inventory.ItemStack; 5 | import org.bukkit.inventory.meta.ItemMeta; 6 | 7 | public class ModelIdSimilar implements ItemStackSimilar { 8 | @Override 9 | public String getName() { 10 | return "modelId"; 11 | } 12 | 13 | @Override 14 | public boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB) { 15 | if (itemStackA == null || itemStackB == null) return false; 16 | ItemMeta metaA = itemStackA.getItemMeta(); 17 | ItemMeta metaB = itemStackB.getItemMeta(); 18 | if (metaA == null || metaB == null) return false; 19 | return metaA.hasCustomModelData() && metaB.hasCustomModelData() && metaA.getCustomModelData() == metaB.getCustomModelData(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/itemstack/NameSimilar.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.itemstack; 2 | 3 | import fr.maxlego08.menu.api.itemstack.ItemStackSimilar; 4 | import org.bukkit.inventory.ItemStack; 5 | import org.bukkit.inventory.meta.ItemMeta; 6 | 7 | public class NameSimilar implements ItemStackSimilar { 8 | @Override 9 | public String getName() { 10 | return "name"; 11 | } 12 | 13 | @Override 14 | public boolean isSimilar(ItemStack itemStackA, ItemStack itemStackB) { 15 | if (itemStackA == null || itemStackB == null) return false; 16 | ItemMeta metaA = itemStackA.getItemMeta(); 17 | ItemMeta metaB = itemStackB.getItemMeta(); 18 | if (metaA == null || metaB == null) return false; 19 | return metaA.hasDisplayName() && metaB.hasDisplayName() && metaA.getDisplayName().equals(metaB.getDisplayName()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/listener/HeadDatabaseListener.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.listener; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import me.arcaniax.hdb.api.DatabaseLoadEvent; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.Listener; 7 | 8 | public class HeadDatabaseListener implements Listener { 9 | 10 | private final MenuPlugin plugin; 11 | 12 | /** 13 | * @param plugin 14 | */ 15 | public HeadDatabaseListener(MenuPlugin plugin) { 16 | super(); 17 | this.plugin = plugin; 18 | } 19 | 20 | @EventHandler 21 | public void onRead(DatabaseLoadEvent event) { 22 | this.plugin.getSavers().forEach(saver -> saver.load(this.plugin.getPersist())); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/listener/SwapKeyListener.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.listener; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.InventoryManager; 5 | import fr.maxlego08.menu.save.Config; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.event.EventHandler; 8 | import org.bukkit.event.Listener; 9 | import org.bukkit.event.player.PlayerSwapHandItemsEvent; 10 | 11 | /** 12 | * Allows to use the key to change item in his second hand, by default the key will be F 13 | */ 14 | public class SwapKeyListener implements Listener { 15 | @EventHandler 16 | public void onPressKey(PlayerSwapHandItemsEvent event) { 17 | if (Config.useSwapItemOffHandKeyToOpenMainMenu) { 18 | InventoryManager inventoryManager = MenuPlugin.getInstance().getInventoryManager(); 19 | Player player = event.getPlayer(); 20 | 21 | if (Config.useSwapItemOffHandKeyToOpenMainMenuNeedsShift) { 22 | if (player.isSneaking()) { 23 | inventoryManager.openInventory(player, Config.mainMenu); 24 | event.setCancelled(true); 25 | } 26 | } else { 27 | inventoryManager.openInventory(player, Config.mainMenu); 28 | event.setCancelled(true); 29 | } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/ActionBarLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.ActionBarAction; 7 | 8 | import java.io.File; 9 | 10 | public class ActionBarLoader implements ActionLoader { 11 | 12 | @Override 13 | public String getKey() { 14 | return "action,actionbar"; 15 | } 16 | 17 | @Override 18 | public Action load(String path, TypedMapAccessor accessor, File file) { 19 | boolean miniMessage = accessor.getBoolean("minimessage", true); 20 | String message = accessor.getString("message"); 21 | return new ActionBarAction(message, miniMessage); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/BackLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.requirement.actions.BackAction; 8 | import fr.maxlego08.menu.requirement.actions.InventoryAction; 9 | 10 | import java.io.File; 11 | 12 | public class BackLoader implements ActionLoader { 13 | 14 | private final MenuPlugin plugin; 15 | 16 | public BackLoader(MenuPlugin plugin) { 17 | this.plugin = plugin; 18 | } 19 | 20 | @Override 21 | public String getKey() { 22 | return "back"; 23 | } 24 | 25 | @Override 26 | public Action load(String path, TypedMapAccessor accessor, File file) { 27 | return new BackAction(this.plugin.getInventoryManager()); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/BookLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.OpenBookAction; 7 | 8 | import java.io.File; 9 | import java.util.ArrayList; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | public class BookLoader implements ActionLoader { 15 | 16 | @Override 17 | public String getKey() { 18 | return "book"; 19 | } 20 | 21 | @Override 22 | public Action load(String path, TypedMapAccessor accessor, File file) { 23 | 24 | String title = accessor.getString("title"); 25 | String author = accessor.getString("subtitle"); 26 | List lines = new ArrayList<>(); 27 | 28 | Map> maps = (Map>) accessor.getObject("lines", new HashMap<>()); 29 | maps.forEach((page, currentLine) -> lines.add(String.join("", currentLine))); 30 | 31 | return new OpenBookAction(title, author, lines); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/BroadcastLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.requirement.Permissible; 7 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 8 | import fr.maxlego08.menu.requirement.actions.BroadcastAction; 9 | 10 | import java.io.File; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.Map; 14 | 15 | public class BroadcastLoader implements ActionLoader { 16 | 17 | 18 | private final MenuPlugin plugin; 19 | 20 | public BroadcastLoader(MenuPlugin plugin) { 21 | this.plugin = plugin; 22 | } 23 | 24 | @Override 25 | public String getKey() { 26 | return "broadcast"; 27 | } 28 | 29 | @Override 30 | public Action load(String path, TypedMapAccessor accessor, File file) { 31 | boolean miniMessage = accessor.getBoolean("minimessage", accessor.getBoolean("mini-message", true)); 32 | List messages = accessor.getStringList("messages"); 33 | List requirements = new ArrayList<>(); 34 | if (accessor.contains("requirements")) { 35 | requirements = this.plugin.getButtonManager().loadPermissible((List>) accessor.getObject("requirements"), path, file); 36 | } 37 | return new BroadcastAction(messages, miniMessage, requirements); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/BroadcastSoundLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.requirement.Action; 4 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 5 | import fr.maxlego08.menu.requirement.actions.BroadcastSoundAction; 6 | 7 | import java.io.File; 8 | 9 | public class BroadcastSoundLoader extends SoundLoader { 10 | 11 | @Override 12 | public String getKey() { 13 | return "broadcast_sound,broadcast sound"; 14 | } 15 | 16 | @Override 17 | public Action load(String path, TypedMapAccessor accessor, File file) { 18 | return new BroadcastSoundAction(loadSound(path, accessor, file)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/ChatLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.MessageAction; 7 | import fr.maxlego08.menu.requirement.actions.PlayerChatAction; 8 | 9 | import java.io.File; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | public class ChatLoader implements ActionLoader { 15 | 16 | @Override 17 | public String getKey() { 18 | return "chat"; 19 | } 20 | 21 | @Override 22 | public Action load(String path, TypedMapAccessor accessor, File file) { 23 | List commands = accessor.getStringList("messages"); 24 | return new PlayerChatAction(commands); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/CloseLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.CloseAction; 7 | import fr.maxlego08.menu.requirement.actions.MessageAction; 8 | 9 | import java.io.File; 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.Map; 13 | 14 | public class CloseLoader implements ActionLoader { 15 | 16 | @Override 17 | public String getKey() { 18 | return "close"; 19 | } 20 | 21 | @Override 22 | public Action load(String path, TypedMapAccessor accessor, File file) { 23 | return new CloseAction(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/ConnectLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.requirement.actions.ConnectAction; 8 | 9 | import java.io.File; 10 | import java.util.Map; 11 | 12 | public class ConnectLoader implements ActionLoader { 13 | 14 | private final MenuPlugin plugin; 15 | 16 | public ConnectLoader(MenuPlugin plugin) { 17 | this.plugin = plugin; 18 | } 19 | 20 | @Override 21 | public String getKey() { 22 | return "connect"; 23 | } 24 | 25 | @Override 26 | public Action load(String path, TypedMapAccessor accessor, File file) { 27 | String server = accessor.getString("server", "hub"); 28 | return new ConnectAction(server, plugin); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/ConsoleCommandLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.ConsoleCommandAction; 7 | 8 | import java.io.File; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class ConsoleCommandLoader implements ActionLoader { 14 | 15 | @Override 16 | public String getKey() { 17 | return "console_command,console_commands,console commands,console command,command,commands,console-commands,console-command"; 18 | } 19 | 20 | @Override 21 | public Action load(String path, TypedMapAccessor accessor, File file) { 22 | List commands = accessor.getStringList("commands"); 23 | return new ConsoleCommandAction(commands); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/CurrencyDepositLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.CurrencyDepositAction; 7 | import fr.traqueur.currencies.Currencies; 8 | 9 | import java.io.File; 10 | import java.math.BigDecimal; 11 | 12 | public class CurrencyDepositLoader implements ActionLoader { 13 | 14 | @Override 15 | public String getKey() { 16 | return "deposit,money add"; 17 | } 18 | 19 | @Override 20 | public Action load(String path, TypedMapAccessor accessor, File file) { 21 | String bigDecimal = accessor.getString("amount"); 22 | Currencies currencies = Currencies.valueOf(accessor.getString("currency", Currencies.VAULT.name()).toUpperCase()); 23 | String economyName = accessor.getString("economy", null); 24 | return new CurrencyDepositAction(bigDecimal, currencies, economyName); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/CurrencyWithdrawLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.CurrencyWithdrawAction; 7 | import fr.traqueur.currencies.Currencies; 8 | 9 | import java.io.File; 10 | import java.math.BigDecimal; 11 | 12 | public class CurrencyWithdrawLoader implements ActionLoader { 13 | 14 | @Override 15 | public String getKey() { 16 | return "withdraw,money remove"; 17 | } 18 | 19 | @Override 20 | public Action load(String path, TypedMapAccessor accessor, File file) { 21 | String bigDecimal = accessor.getString("amount"); 22 | Currencies currencies = Currencies.valueOf(accessor.getString("currency", Currencies.VAULT.name()).toUpperCase()); 23 | String economyName = accessor.getString("economy", null); 24 | return new CurrencyWithdrawAction(bigDecimal, currencies, economyName); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/DataLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.requirement.data.ActionPlayerDataType; 7 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 8 | import fr.maxlego08.menu.requirement.ZActionPlayerData; 9 | import fr.maxlego08.menu.requirement.actions.DataAction; 10 | 11 | import java.io.File; 12 | 13 | public class DataLoader implements ActionLoader { 14 | 15 | private final MenuPlugin plugin; 16 | 17 | public DataLoader(MenuPlugin plugin) { 18 | this.plugin = plugin; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "data"; 24 | } 25 | 26 | @Override 27 | public Action load(String path, TypedMapAccessor accessor, File file) { 28 | ActionPlayerDataType type = ActionPlayerDataType.valueOf(accessor.getString("action", "SET").toUpperCase()); 29 | String key = accessor.getString("key"); 30 | Object object = accessor.getObject("value", true); 31 | long seconds = accessor.getLong("seconds", 0L); 32 | return new DataAction(new ZActionPlayerData(key, type, object, seconds), plugin); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/InventoryLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.requirement.actions.InventoryAction; 8 | 9 | import java.io.File; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class InventoryLoader implements ActionLoader { 14 | 15 | private final MenuPlugin plugin; 16 | 17 | public InventoryLoader(MenuPlugin plugin) { 18 | this.plugin = plugin; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "inventory"; 24 | } 25 | 26 | @Override 27 | public Action load(String path, TypedMapAccessor accessor, File file) { 28 | String inventory = accessor.getString("inventory"); 29 | String plugin = accessor.getString("plugin"); 30 | String page = accessor.getString("page"); 31 | List arguments = accessor.getStringList("arguments"); 32 | return new InventoryAction(this.plugin.getInventoryManager(), this.plugin.getCommandManager(), inventory, plugin, page, arguments); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/LuckPermissionSetLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.LuckPermissionSet; 7 | 8 | import java.io.File; 9 | 10 | public class LuckPermissionSetLoader implements ActionLoader { 11 | 12 | @Override 13 | public String getKey() { 14 | return "permission-set,permission set,set permission,set-permission"; 15 | } 16 | 17 | @Override 18 | public Action load(String path, TypedMapAccessor accessor, File file) { 19 | String permission = accessor.getString("permission"); 20 | return new LuckPermissionSet(permission); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/MessageLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.MessageAction; 7 | 8 | import java.io.File; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class MessageLoader implements ActionLoader { 13 | 14 | @Override 15 | public String getKey() { 16 | return "message,messages"; 17 | } 18 | 19 | @Override 20 | public Action load(String path, TypedMapAccessor accessor, File file) { 21 | boolean miniMessage = accessor.getBoolean("minimessage", accessor.getBoolean("mini-message", true)); 22 | List messages = new ArrayList<>(); 23 | if (accessor.contains("message")) { 24 | messages.add(accessor.getString("message")); 25 | } else if (accessor.contains("messages")) { 26 | Object element = accessor.getObject("messages", new ArrayList<>()); 27 | if (element instanceof String) { 28 | messages.add((String) element); 29 | } else { 30 | messages = accessor.getStringList("messages"); 31 | } 32 | } 33 | return new MessageAction(messages, miniMessage); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/PlayerCommandLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.PlayerCommandAction; 7 | 8 | import java.io.File; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import java.util.Map; 12 | 13 | public class PlayerCommandLoader implements ActionLoader { 14 | 15 | @Override 16 | public String getKey() { 17 | return "player_command,player_commands,player command,player commands,player-command,player-commands"; 18 | } 19 | 20 | @Override 21 | public Action load(String path, TypedMapAccessor accessor, File file) { 22 | boolean inChat = accessor.getBoolean("commandInChat", accessor.getBoolean("command-in-chat", false)); 23 | List commands = accessor.getStringList("commands"); 24 | return new PlayerCommandAction(commands, inChat); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/RefreshLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.RefreshAction; 7 | 8 | import java.io.File; 9 | 10 | public class RefreshLoader implements ActionLoader { 11 | 12 | @Override 13 | public String getKey() { 14 | return "refresh"; 15 | } 16 | 17 | @Override 18 | public Action load(String path, TypedMapAccessor accessor, File file) { 19 | return new RefreshAction(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/ShopkeeperLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.ShopkeeperAction; 7 | 8 | import java.io.File; 9 | 10 | public class ShopkeeperLoader implements ActionLoader { 11 | @Override 12 | public String getKey() { 13 | return "shopkeeper"; 14 | } 15 | 16 | @Override 17 | public Action load(String path, TypedMapAccessor accessor, File file) { 18 | String name = accessor.getString("name", "error_name"); 19 | return new ShopkeeperAction(name); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/SoundLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import com.cryptomorin.xseries.XSound; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.sound.SoundOption; 7 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 8 | import fr.maxlego08.menu.requirement.actions.SoundAction; 9 | import fr.maxlego08.menu.sound.ZSoundOption; 10 | 11 | import java.io.File; 12 | 13 | public class SoundLoader implements ActionLoader { 14 | 15 | @Override 16 | public String getKey() { 17 | return "sound"; 18 | } 19 | 20 | @Override 21 | public Action load(String path, TypedMapAccessor accessor, File file) { 22 | return new SoundAction(loadSound(path, accessor, file)); 23 | } 24 | 25 | protected SoundOption loadSound(String path, TypedMapAccessor accessor, File file) { 26 | String sound = accessor.getString("sound"); 27 | float pitch = accessor.getFloat("pitch", 1f); 28 | float volume = accessor.getFloat("volume", 1f); 29 | String category = accessor.getString("sound-category", accessor.getString("category", XSound.Category.MASTER.name())); 30 | XSound xSound = sound == null || sound.isEmpty() ? null : XSound.of(sound).orElse(null); 31 | return new ZSoundOption(xSound, category, sound, pitch, volume, xSound == null); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/TeleportLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.MenuPlugin; 4 | import fr.maxlego08.menu.api.loader.ActionLoader; 5 | import fr.maxlego08.menu.api.requirement.Action; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.requirement.actions.ActionBarAction; 8 | import fr.maxlego08.menu.requirement.actions.TeleportAction; 9 | import org.bukkit.Bukkit; 10 | import org.bukkit.Location; 11 | 12 | import java.io.File; 13 | 14 | public class TeleportLoader implements ActionLoader { 15 | 16 | private final MenuPlugin plugin; 17 | 18 | public TeleportLoader(MenuPlugin plugin) { 19 | this.plugin = plugin; 20 | } 21 | 22 | @Override 23 | public String getKey() { 24 | return "teleport,tp"; 25 | } 26 | 27 | @Override 28 | public Action load(String path, TypedMapAccessor accessor, File file) { 29 | String world = accessor.getString("world", "world"); 30 | double x = Double.parseDouble(accessor.getString("x", "0.0")); 31 | double y = Double.parseDouble(accessor.getString("y", "0.0")); 32 | double z = Double.parseDouble(accessor.getString("z", "0.0")); 33 | float yaw = Float.parseFloat(accessor.getString("yaw", "0.0")); 34 | float pitch = Float.parseFloat(accessor.getString("pitch", "0.0")); 35 | return new TeleportAction(this.plugin, new Location(Bukkit.getWorld(world), x, y, z, yaw, pitch)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/actions/TitleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.actions; 2 | 3 | import fr.maxlego08.menu.api.loader.ActionLoader; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 6 | import fr.maxlego08.menu.requirement.actions.TitleAction; 7 | 8 | import java.io.File; 9 | 10 | public class TitleLoader implements ActionLoader { 11 | 12 | @Override 13 | public String getKey() { 14 | return "title"; 15 | } 16 | 17 | @Override 18 | public Action load(String path, TypedMapAccessor accessor, File file) { 19 | 20 | String title = accessor.getString("title"); 21 | String subtitle = accessor.getString("subtitle"); 22 | long start = accessor.getLong("start"); 23 | long duration = accessor.getLong("duration"); 24 | long end = accessor.getLong("end"); 25 | 26 | return new TitleAction(title, subtitle, start, duration, end); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/ArmorLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import org.bukkit.configuration.file.YamlConfiguration; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.inventory.EquipmentSlot; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class ArmorLoader implements MaterialLoader { 10 | @Override 11 | public String getKey() { 12 | return "armor"; 13 | } 14 | 15 | @Override 16 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 17 | return player.getEquipment().getItem(EquipmentSlot.valueOf(materialString)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/Base64Loader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import fr.maxlego08.menu.zcore.utils.nms.ItemStackUtils; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class Base64Loader implements MaterialLoader { 10 | @Override 11 | public String getKey() { 12 | return "base64"; 13 | } 14 | 15 | @Override 16 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 17 | return ItemStackUtils.deserializeItemStack(materialString); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/EcoLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import com.willfp.eco.core.items.Items; 4 | import fr.maxlego08.menu.api.loader.MaterialLoader; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class EcoLoader implements MaterialLoader { 10 | @Override 11 | public String getKey() { 12 | return "eco"; 13 | } 14 | 15 | @Override 16 | public ItemStack load(Player player, YamlConfiguration yamlConfiguration, String path, String materialString) { 17 | try { 18 | //eco item lookup system: 19 | // https://plugins.auxilor.io/all-plugins/the-item-lookup-system 20 | return Items.lookup(materialString).getItem(); 21 | } catch (Exception ignored) { 22 | return null; 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/HeadDatabaseLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import me.arcaniax.hdb.api.HeadDatabaseAPI; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class HeadDatabaseLoader implements MaterialLoader { 10 | 11 | @Override 12 | public String getKey() { 13 | return "hdb"; 14 | } 15 | 16 | @Override 17 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 18 | 19 | try { 20 | 21 | HeadDatabaseAPI api = new HeadDatabaseAPI(); 22 | return api.getItemHead(materialString); 23 | 24 | } catch (Exception exception) { 25 | exception.printStackTrace(); 26 | } 27 | 28 | return null; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/ItemsAdderLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import dev.lone.itemsadder.api.CustomStack; 4 | import fr.maxlego08.menu.api.loader.MaterialLoader; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | import org.bukkit.plugin.Plugin; 9 | 10 | public class ItemsAdderLoader implements MaterialLoader { 11 | 12 | private final Plugin plugin; 13 | 14 | public ItemsAdderLoader(Plugin plugin) { 15 | this.plugin = plugin; 16 | } 17 | 18 | @Override 19 | public String getKey() { 20 | return "itemsadder"; 21 | } 22 | 23 | @Override 24 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 25 | CustomStack customStack = CustomStack.getInstance(materialString); 26 | if (customStack == null) { 27 | plugin.getLogger().severe("Impossible to find the item " + materialString); 28 | return null; 29 | } 30 | return customStack.getItemStack().clone(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/MagicCosmeticsLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import org.bukkit.Material; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | import com.francobm.magicosmetics.api.MagicAPI; 9 | 10 | public class MagicCosmeticsLoader implements MaterialLoader { 11 | 12 | @Override 13 | public String getKey() { 14 | return "magic_cosmetics"; 15 | } 16 | 17 | @Override 18 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 19 | ItemStack itemStack = MagicAPI.getEquipped(player.getName(), materialString); 20 | if (itemStack == null){ 21 | return new ItemStack(Material.AIR); 22 | } 23 | return itemStack; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/NexoLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import com.nexomc.nexo.api.NexoItems; 4 | import com.nexomc.nexo.items.ItemBuilder; 5 | import fr.maxlego08.menu.api.loader.MaterialLoader; 6 | import org.bukkit.configuration.file.YamlConfiguration; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | 10 | /* 11 | * If you have problems compiling this class, delete it there; At the moment, it is impossible to access the nexo API. 12 | * */ 13 | public class NexoLoader implements MaterialLoader { 14 | 15 | @Override 16 | public String getKey() { 17 | return "nexo"; 18 | } 19 | 20 | @Override 21 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 22 | ItemBuilder builder = NexoItems.itemFromId(materialString); 23 | return builder == null ? null : builder.build(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/NovaLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import org.bukkit.configuration.file.YamlConfiguration; 5 | import org.bukkit.entity.Player; 6 | import org.bukkit.inventory.ItemStack; 7 | import xyz.xenondevs.nova.api.Nova; 8 | import xyz.xenondevs.nova.api.block.NovaBlockRegistry; 9 | import xyz.xenondevs.nova.api.item.NovaItemRegistry; 10 | 11 | import java.util.Objects; 12 | 13 | public class NovaLoader implements MaterialLoader { 14 | @Override 15 | public String getKey() { 16 | return "nova"; 17 | } 18 | 19 | @Override 20 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 21 | NovaBlockRegistry blockRegistry = Nova.getNova().getBlockRegistry(); 22 | NovaItemRegistry itemRegistry = Nova.getNova().getItemRegistry(); 23 | return blockRegistry.getOrNull(materialString) == null ? itemRegistry.get(materialString).createItemStack() : Objects.requireNonNull(blockRegistry.get(materialString).getItem()).createItemStack(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/OraxenLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import io.th0rgal.oraxen.api.OraxenItems; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class OraxenLoader implements MaterialLoader { 10 | 11 | @Override 12 | public String getKey() { 13 | return "oraxen"; 14 | } 15 | 16 | @Override 17 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 18 | return OraxenItems.getItemById(materialString).build(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/SlimeFunLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.menu.api.loader.MaterialLoader; 4 | import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem; 5 | import org.bukkit.configuration.file.YamlConfiguration; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | public class SlimeFunLoader implements MaterialLoader { 10 | @Override 11 | public String getKey() { 12 | return "slimefun"; 13 | } 14 | 15 | @Override 16 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 17 | return SlimefunItem.getById(materialString).getItem(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/ZHeadLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.head.api.HeadManager; 4 | import fr.maxlego08.menu.MenuPlugin; 5 | import fr.maxlego08.menu.api.loader.MaterialLoader; 6 | import org.bukkit.configuration.file.YamlConfiguration; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | 10 | public class ZHeadLoader implements MaterialLoader { 11 | 12 | private final HeadManager headManager; 13 | 14 | public ZHeadLoader(MenuPlugin plugin) { 15 | this.headManager = plugin.getProvider(HeadManager.class); 16 | } 17 | 18 | @Override 19 | public String getKey() { 20 | return "zhd"; 21 | } 22 | 23 | @Override 24 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 25 | return this.headManager.createItemStack(materialString); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/materials/ZItemsLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.materials; 2 | 3 | import fr.maxlego08.items.api.Item; 4 | import fr.maxlego08.items.api.ItemManager; 5 | import fr.maxlego08.menu.api.loader.MaterialLoader; 6 | import org.bukkit.configuration.file.YamlConfiguration; 7 | import org.bukkit.entity.Player; 8 | import org.bukkit.inventory.ItemStack; 9 | import org.bukkit.plugin.Plugin; 10 | import org.bukkit.plugin.RegisteredServiceProvider; 11 | 12 | import java.util.Optional; 13 | 14 | public class ZItemsLoader implements MaterialLoader { 15 | 16 | private final Plugin plugin; 17 | 18 | public ZItemsLoader(Plugin plugin) { 19 | this.plugin = plugin; 20 | } 21 | 22 | @Override 23 | public String getKey() { 24 | return "zitems"; 25 | } 26 | 27 | @Override 28 | public ItemStack load(Player player, YamlConfiguration configuration, String path, String materialString) { 29 | RegisteredServiceProvider itemManagerRegisteredServiceProvider = plugin.getServer().getServicesManager().getRegistration(ItemManager.class); 30 | if (itemManagerRegisteredServiceProvider == null) return null; 31 | ItemManager itemManager = itemManagerRegisteredServiceProvider.getProvider(); 32 | Optional optional = itemManager.getItem(materialString); 33 | return optional.map(item -> item.build(player, 1)).orElse(null); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/CurrencyPermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZCurrencyPermissible; 9 | import fr.traqueur.currencies.Currencies; 10 | 11 | import java.io.File; 12 | import java.math.BigDecimal; 13 | import java.util.List; 14 | 15 | public class CurrencyPermissibleLoader extends ZPermissibleLoader { 16 | 17 | private final ButtonManager buttonManager; 18 | 19 | public CurrencyPermissibleLoader(ButtonManager buttonManager) { 20 | this.buttonManager = buttonManager; 21 | } 22 | 23 | @Override 24 | public String getKey() { 25 | return "money"; 26 | } 27 | 28 | @Override 29 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 30 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 31 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 32 | String amount = accessor.getString("amount"); 33 | Currencies currencies = Currencies.valueOf(accessor.getString("currency", Currencies.VAULT.name()).toUpperCase()); 34 | String economyName = accessor.getString("economy", null); 35 | return new ZCurrencyPermissible(denyActions, successActions, currencies, amount, economyName); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/JobPermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZJobPermissible; 9 | 10 | import java.io.File; 11 | import java.util.List; 12 | 13 | public class JobPermissibleLoader extends ZPermissibleLoader { 14 | 15 | private final ButtonManager buttonManager; 16 | 17 | public JobPermissibleLoader(ButtonManager buttonManager) { 18 | this.buttonManager = buttonManager; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "job"; 24 | } 25 | 26 | @Override 27 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 28 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 29 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 30 | return new ZJobPermissible(denyActions, successActions, accessor.getString("job")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/LuckPermPermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZLuckPermPermissible; 9 | 10 | import java.io.File; 11 | import java.util.List; 12 | 13 | public class LuckPermPermissibleLoader extends ZPermissibleLoader { 14 | 15 | private final ButtonManager buttonManager; 16 | 17 | public LuckPermPermissibleLoader(ButtonManager buttonManager) { 18 | this.buttonManager = buttonManager; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "luckperm"; 24 | } 25 | 26 | @Override 27 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 28 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 29 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 30 | return new ZLuckPermPermissible(denyActions, successActions, accessor.getString("group")); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/PermissionPermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZPermissionPermissible; 9 | 10 | import java.io.File; 11 | import java.util.List; 12 | 13 | public class PermissionPermissibleLoader extends ZPermissibleLoader { 14 | 15 | private final ButtonManager buttonManager; 16 | 17 | public PermissionPermissibleLoader(ButtonManager buttonManager) { 18 | this.buttonManager = buttonManager; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "permission"; 24 | } 25 | 26 | @Override 27 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 28 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 29 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 30 | return new ZPermissionPermissible(accessor.getString("permission"), denyActions, successActions); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/PlayerNamePermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZPlayerNamePermissible; 9 | 10 | import java.io.File; 11 | import java.util.List; 12 | 13 | public class PlayerNamePermissibleLoader extends ZPermissibleLoader { 14 | 15 | private final ButtonManager buttonManager; 16 | 17 | public PlayerNamePermissibleLoader(ButtonManager buttonManager) { 18 | this.buttonManager = buttonManager; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "playername"; 24 | } 25 | 26 | @Override 27 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 28 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 29 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 30 | return new ZPlayerNamePermissible(accessor.getString("playerName", accessor.getString("playername", accessor.getString("player-name"))), denyActions, successActions); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/loader/permissible/RegexPermissibleLoader.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.loader.permissible; 2 | 3 | import fr.maxlego08.menu.api.ButtonManager; 4 | import fr.maxlego08.menu.api.requirement.Action; 5 | import fr.maxlego08.menu.api.requirement.Permissible; 6 | import fr.maxlego08.menu.api.utils.TypedMapAccessor; 7 | import fr.maxlego08.menu.loader.ZPermissibleLoader; 8 | import fr.maxlego08.menu.requirement.permissible.ZRegexPermissible; 9 | 10 | import java.io.File; 11 | import java.util.List; 12 | 13 | public class RegexPermissibleLoader extends ZPermissibleLoader { 14 | 15 | private final ButtonManager buttonManager; 16 | 17 | public RegexPermissibleLoader(ButtonManager buttonManager) { 18 | this.buttonManager = buttonManager; 19 | } 20 | 21 | @Override 22 | public String getKey() { 23 | return "regex"; 24 | } 25 | 26 | @Override 27 | public Permissible load(String path, TypedMapAccessor accessor, File file) { 28 | String placeholder = accessor.getString("input"); 29 | String regex = accessor.getString("regex"); 30 | 31 | List denyActions = loadAction(buttonManager, accessor, "deny", path, file); 32 | List successActions = loadAction(buttonManager, accessor, "success", path, file); 33 | 34 | return new ZRegexPermissible(regex, placeholder, denyActions, successActions); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/fr/maxlego08/menu/pattern/ZPattern.java: -------------------------------------------------------------------------------- 1 | package fr.maxlego08.menu.pattern; 2 | 3 | import fr.maxlego08.menu.api.button.Button; 4 | import fr.maxlego08.menu.api.pattern.Pattern; 5 | 6 | import java.util.List; 7 | 8 | public class ZPattern implements Pattern { 9 | 10 | private final String name; 11 | private final List