File Items is a very lightweight library that helps loading items with customizable features, such as display names, glowing effects, hidden tooltips, amounts, lore, data, durability, unbreakable item flags, and custom keys from a YAML file.
The project isn't in the Central Repository yet, so specifying a repository is needed.
To add this project as a dependency to your project, add the following to your pom.xml:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<dependency>
<groupId>com.github.Despical</groupId>
<artifactId>FileItems</artifactId>
<version>1.1.1</version>
</dependency>
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.Despical:FileItems:1.1.1'
}
import org.bukkit.plugin.java.JavaPlugin;
/**
* @author Despical
* <p>
* Created at 19.09.2024
*/
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
// Create the file if not exist.
ItemManager itemManager = new ItemManager(this);
itemManager.addCustomKey("slot");
itemManager.registerItems("items", "game-items");
SpecialItem item = itemManager.getItem("leave-item");
int slot = item.getCustomKey("slot");
getServer().getOnlinePlayers().forEach(player -> player.getInventory().setItem(slot, item.getItemStack()));
}
}
game-items:
leave-item:
name: "&c&lReturn to Lobby &7(Right Click)"
material: RED_BED
slot: 8
lore:
- "&7Right-click to leave to the lobby!"
This code is under GPL-3.0 License
See the LICENSE file for required notices and attributions.
I accept Pull Requests via GitHub. There are some guidelines which will make applying PRs easier for me:
- Ensure you didn't use spaces! Please use tabs for indentation.
- Respect the code style.
- Do not increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent.
- Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
You can learn more about contributing via GitHub in contribution guidelines.
To build this project from source code, run the following from Git Bash:
git clone https://github.com/Despical/FileItems && cd FileItems
mvn clean package
Important
Maven must be installed to build this project.