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.
To add this project as a dependency to your project, add the following to your pom.xml:
<dependency>
<groupId>dev.despical</groupId>
<artifactId>file-items</artifactId>
<version>1.2.5</version>
</dependency>dependencies {
implementation 'dev.despical:file-items:1.2.5'
}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:
- Respect the code style.
- Ensure you didn't use tabs! Please use spaces for indentation.
- 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://www.github.com/Despical/FileItems && cd FileItems
mvn clean package
Important
Maven must be installed to build this project.