Compare commits
No commits in common. "master" and "1.0" have entirely different histories.
3
.idea/artifacts/giftapi.xml
generated
3
.idea/artifacts/giftapi.xml
generated
@ -5,8 +5,7 @@
|
|||||||
<element id="file-copy" path="$PROJECT_DIR$/src/main/resources/config.yml" />
|
<element id="file-copy" path="$PROJECT_DIR$/src/main/resources/config.yml" />
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/src/main/resources/plugin.yml" />
|
<element id="file-copy" path="$PROJECT_DIR$/src/main/resources/plugin.yml" />
|
||||||
<element id="module-output" name="tokarotik.giftapi.GiftAPI.main" />
|
<element id="module-output" name="tokarotik.giftapi.GiftAPI.main" />
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/README.md" />
|
<element id="file-copy" path="$PROJECT_DIR$/README.txt" />
|
||||||
<element id="file-copy" path="$PROJECT_DIR$/README_ru.md" />
|
|
||||||
</root>
|
</root>
|
||||||
</artifact>
|
</artifact>
|
||||||
</component>
|
</component>
|
104
README.md
104
README.md
@ -1,85 +1,49 @@
|
|||||||
GiftAPI
|
GiftAPI
|
||||||
======
|
=======
|
||||||
|
|
||||||
[Russian](README_ru.md)
|
Плагин для Майнкрафт сервера с ядром Bukkit 1.6.4.
|
||||||
|
Это API + кастомный инвентарь.
|
||||||
|
|
||||||
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
|
- Bukkit 1.6.4
|
||||||
|
|
||||||
Developer
|
Разработчик
|
||||||
---------
|
-----------
|
||||||
- Developer:
|
- Разработчик:
|
||||||
- [GitHub](https://github.com/tokarotik)
|
- [GitHub](https://github.com/tokarotik)
|
||||||
- [Gitea](https://git.artberry.xyz/ToKarotik)
|
- [Gitea](https://git.artberry.xyz/ToKarotik)
|
||||||
- Discord: tokarotik
|
- Discord: tokarotik
|
||||||
|
|
||||||
- Client:
|
- Заказчик:
|
||||||
- [Gitea](https://git.artberry.xyz/Miriko)
|
- [Gitea](https://git.artberry.xyz/Miriko)
|
||||||
- Discord: jetstreambase
|
- Discord: jetstreambase
|
||||||
|
|
||||||
License
|
Лицензия
|
||||||
-------
|
--------
|
||||||
This project is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
Этот проект использует [MIT](https://opensource.org/licenses/MIT) лицензию.
|
82
README_ru.md
82
README_ru.md
@ -1,82 +0,0 @@
|
|||||||
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`.
|
|
||||||
|
|
||||||
Документация
|
|
||||||
------------
|
|
||||||
### `add(player, item)`
|
|
||||||
- **Описание**: добавляет предмет в кастомные инвентарь игрока.
|
|
||||||
- **Параметры**:
|
|
||||||
- `player` (`Player`): игрок которому нужно добавить предмет.
|
|
||||||
- `item` (`ItemStack`): предмет который должен быть сохранен в инвентарь.
|
|
||||||
|
|
||||||
### `remove(player, item)`
|
|
||||||
- **Описание**: удаляет предмет из кастомного инвентаря игрока.
|
|
||||||
- **Параметры**:
|
|
||||||
- `player` (`Player`): игрок которому нужно удалить предмет.
|
|
||||||
- `item` (`ItemStack`): предмет который должен быть удалён из инвентаря.
|
|
||||||
|
|
||||||
### `openGUI()`
|
|
||||||
- **Описание**: открывает кастомный инвентарь игрока.
|
|
||||||
- **Параметры**:
|
|
||||||
- `player` (`Player`): игрок которому нужно открыть кастомный инвентарь.
|
|
||||||
|
|
||||||
Пример Использования
|
|
||||||
--------------------
|
|
||||||
```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);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Требования
|
|
||||||
----------
|
|
||||||
- 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) лицензию.
|
|
@ -17,7 +17,7 @@ import tokarotik.giftapi.inventory.InventoryManager;
|
|||||||
public class APIManager implements Listener {
|
public class APIManager implements Listener {
|
||||||
private final InventoryManager inventoryManager;
|
private final InventoryManager inventoryManager;
|
||||||
|
|
||||||
public APIManager(GiftAPI plugin, FileConfiguration config, int inventorySlots) {
|
public APIManager(Main plugin, FileConfiguration config, int inventorySlots) {
|
||||||
if (plugin == null || config == null) {
|
if (plugin == null || config == null) {
|
||||||
throw new IllegalArgumentException("Plugin and config must not be null.");
|
throw new IllegalArgumentException("Plugin and config must not be null.");
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import tokarotik.giftapi.cache.CacheManager;
|
import tokarotik.giftapi.cache.CacheManager;
|
||||||
|
|
||||||
public class GiftAPI extends JavaPlugin implements Listener {
|
public class Main extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
private static final int INVENTORY_SLOTS = 54;
|
private static final int INVENTORY_SLOTS = 54;
|
||||||
private static final int CACHED_SLOTS = INVENTORY_SLOTS - 9;
|
private static final int CACHED_SLOTS = INVENTORY_SLOTS - 9;
|
@ -1,3 +1,3 @@
|
|||||||
name: GiftAPI
|
name: GiftAPI
|
||||||
version: 1.1
|
version: 1.0
|
||||||
main: tokarotik.giftapi.GiftAPI
|
main: tokarotik.giftapi.Main
|
Loading…
x
Reference in New Issue
Block a user