diff --git a/README.md b/README.md index 920a8cf..b372440 100644 --- a/README.md +++ b/README.md @@ -1,49 +1,84 @@ GiftAPI -======= +====== -Плагин для Майнкрафт сервера с ядром Bukkit 1.6.4. -Это API + кастомный инвентарь. +[Russian](README_ru.md) -Использование +A plugin for Minecraft servers using the Bukkit 1.6.4 core. +This is both an API and a custom inventory system. + +Usage +----- + +1. Download the release or build the plugin yourself. +2. Move it to the `ROOT-SERVER-FOLDER/plugins` directory. +3. Copy it into the root folder of your plugin. +4. In your IDE, import `giftapi.jar`. +5. Use the usage example and documentation to work with the API. +6. Build your plugin into a JAR file. +7. Copy the resulting JAR file to `ROOT-SERVER-FOLDER/plugins`. +8. Start the server or run the `/reload` command. + +Documentation ------------- -1. Скачайте релиз или соберите плагин сами. -2. Переместите в папку КОРНЕВАЯ-ПАПКА-СЕРВЕРА/plugins. -3. Запустите сервер или введите команду /reload. -Документация +### `add(player, item)` +- **Description**: Adds an item to the player's custom inventory. +- **Parameters**: + - `player` (`Player`): The player who will receive the item. + - `item` (`ItemStack`): The item to be added to the inventory. + +### `remove(player, item)` +- **Description**: Removes an item from the player's custom inventory. +- **Parameters**: + - `player` (`Player`): The player whose item will be removed. + - `item` (`ItemStack`): The item to be removed from the inventory. + +### `openGUI(player)` +- **Description**: Opens the custom inventory for the player. +- **Parameters**: + - `player` (`Player`): The player whose custom inventory will be opened. + +Example Usage +------------- + +```java +import tokarotik.giftapi.GiftAPI; + +// Get plugin instance +Plugin plugin = Bukkit.getPluginManager().getPlugin("GiftAPI"); + +if (plugin != null && plugin.isEnabled() && plugin instanceof GiftAPI) { + // Set up API + GiftAPI giftAPI = (GiftAPI) plugin; + + // Get the first online player + Player player = Bukkit.getOnlinePlayers()[0]; + + // Create an item (stick) + ItemStack item = new ItemStack(Material.STICK); + + // Add item to player's custom inventory + giftAPI.add(player, item); + + // Open the custom inventory GUI + giftAPI.openGUI(player); +} + +Requirements ------------ -1. 'add(player, item)' - - Описание: добавляет предмет в кастомные инвентарь игрока. - - Параметры: - - 'player' (Player): игрок которому нужно добавить предмет. - - 'item' (ItemStack): предмет который должен быть сохранен в инвентарь. - -2. 'remove(player, item)' - - Описание: удаляет предмет из кастомного инвентаря игрока. - - Параметры: - - 'player' (Player): игрок которому нужно удалить предмет. - - 'item' (ItemStack): предмет который должен быть удалён из инвентаря. - -3. 'openGUI()' - - Описание: открывает кастомный инвентарь игрока. - - Параметры: - - 'player' (Player): игрок которому нужно открыть кастомный инвентарь. - -Требования ----------- - Bukkit 1.6.4 -Разработчик ------------ -- Разработчик: +Developer +--------- +- Developer: - [GitHub](https://github.com/tokarotik) - [Gitea](https://git.artberry.xyz/ToKarotik) - Discord: tokarotik -- Заказчик: +- Client: - [Gitea](https://git.artberry.xyz/Miriko) - Discord: jetstreambase -Лицензия --------- -Этот проект использует [MIT](https://opensource.org/licenses/MIT) лицензию. \ No newline at end of file +License +------- +This project is licensed under the [MIT License](https://opensource.org/licenses/MIT). \ No newline at end of file diff --git a/README_ru.md b/README_ru.md new file mode 100644 index 0000000..18b0df5 --- /dev/null +++ b/README_ru.md @@ -0,0 +1,80 @@ +GiftAPI +======= + +[English](README.md) + +Плагин для Майнкрафт сервера с ядром Bukkit 1.6.4. +Это API + кастомный инвентарь. + +Использование +------------- +1. Скачайте релиз или соберите плагин сами. +2. Переместите в папку КОРНЕВАЯ-ПАПКА-СЕРВЕРА/plugins. +3. Скопируйте в рут папку вашего плагина. +4. В вашей IDE импортируете giftapi.jar. +5. *Используйте пример использования и документация для использования API* +6. Соберите ваш плагин в JAR. +7. Скопируйте получившися JAR файл в КОРНЕВАЯ-ПАПКА-СЕРВЕРА/plugins. +3. Запустите сервер или введите команду /reload. + +Документация +------------ +1. 'add(player, item)' + - Описание: добавляет предмет в кастомные инвентарь игрока. + - Параметры: + - 'player' (Player): игрок которому нужно добавить предмет. + - 'item' (ItemStack): предмет который должен быть сохранен в инвентарь. + +2. 'remove(player, item)' + - Описание: удаляет предмет из кастомного инвентаря игрока. + - Параметры: + - 'player' (Player): игрок которому нужно удалить предмет. + - 'item' (ItemStack): предмет который должен быть удалён из инвентаря. + +3. 'openGUI()' + - Описание: открывает кастомный инвентарь игрока. + - Параметры: + - 'player' (Player): игрок которому нужно открыть кастомный инвентарь. + +Пример Использования +-------------------- +... + +import tokarotik.giftapi.GiftAPI; + +... + +// get plugin +Plugin plugin = Bukkit.getPluginManager().getPlugin("GiftAPI"); + +if (plugin != null && plugin.isEnabled() && plugin instanceof GiftAPI) { + // set up api + GiftAPI giftAPI = (GiftAPI) plugin; + // find first online player + Player player = Bukkit.getOnlinePlayers()[0]; + // create item stick + ItemStack item = new ItemStack(Material.STICK); + // add to player stick + giftAPI.add(player, item); + // open inventory + giftAPI.openGUI(player); +} + +Требования +---------- +- Bukkit 1.6.4 + +Разработчик +----------- +- Разработчик: + - [GitHub](https://github.com/tokarotik) + - [Gitea](https://git.artberry.xyz/ToKarotik) + - Discord: tokarotik + +- Заказчик: + - [Gitea](https://git.artberry.xyz/Miriko) + - Discord: jetstreambase + +Лицензия +-------- +Этот проект использует [MIT](https://opensource.org/licenses/MIT) лицензию. \ No newline at end of file