https://github.com/lucemans/novaitems
A Simple Lightweight Item Creation Library for Bukkit/Spigot
https://github.com/lucemans/novaitems
Last synced: 2 months ago
JSON representation
A Simple Lightweight Item Creation Library for Bukkit/Spigot
- Host: GitHub
- URL: https://github.com/lucemans/novaitems
- Owner: lucemans
- License: gpl-3.0
- Created: 2018-04-14T23:16:37.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-22T00:37:35.000Z (almost 3 years ago)
- Last Synced: 2025-03-21T06:46:42.114Z (over 1 year ago)
- Language: Java
- Size: 53.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NovaItems
Easily use inline Item Creation System.
This project was made since their is no easy way to do proper Item creation within the Spigot / Bukkit APIs. It supports all Spigot and Bukkit versions and does not require NMS at all.
## Requirements
Java and Bukkit / Spigot. Most server versions in the [Spigot Repository](https://hub.spigotmc.org/nexus/) are supported.
### Something doesn't work
If you are a developing using NovaItems, post your code somehwere and I would happily look into it.
## How to use
### As a dependency
```xml
nl.lucemans
NovaItems
1.3-SNAPSHOT
...
lucemans-repo
https://repo.lucemans.nl/
...
```
### In your plugin
#### Creating an item from scratch
```java
NItem.create(Material.GOLD_AXE).make();
```
The above code simply creates a new Instance of NItem of type GOLD_AXE.
The ```make()``` function simply fabricates the ```ItemStack```.
#### Creating an item from another item
```java
ItemStack itemstack = new ItemStack(Material.STONE);
NItem.create(itemstack).make();
```
If you want to modify an item that you already have in the form of an ```ItemStack``` you can easily do this, just put the ```ItemStack``` in the ```create``` method and its data will be imported.
### Item Properties
To set any of the following properties is fairly simple and self-explainatory.
#### Display Name
```java
NItem.create(Material.GOLD_AXE).setName("&c&lBleeding &6&lAxe").make();
```
The Item Display Name by default supports color codes, to disable this see [setNameColor](#coloring).
#### Amount
```java
NItem.create(Material.GOLD_AXE).setName("&c&lBleeding &6&lAxe").make();
```
#### Description / Lore
```java
NItem.create(Material.GOLD_AXE).setLore("This is the first line", "&rThis is the &asecond &rline").make();
```
or if you prefer using a list
```java
ArrayList lore = new ArrayList();
lore.add("This is the first line");
lore.add("&rThis is the &asecond &rline");
NItem.create(Material.GOLD_AXE).setLore(lore).make();
```
The item's description/lore by default supports color codes, to disable this see [setLoreColor](#coloring).
#### Enchantments
```java
NItem.create(Material.GOLD_AXE).setEnchantment(Enchantment.DURABILITY, 8).make();
```
To add enchantments to your Item you can use the ```setEnchantment(Enchantment, Level)``` method. As the name suggests it will add the specified enchantment with this level to the item. The system supports unsafe enchantments, this means items can have insane high or low levels, such as 5, 10, -10 or any other ```Integer```.
#### Item Flags
```java
NItem.create(Material.GOLD_AXE).setItemFlag(ItemFlag.HIDE_ENCHANTS).make();
```
To use ItemFlags, you can simply perform the ```setItemFlag``` method to set itemflags. This method also supports multiple arguments so you can set multiple ItemFlags at the same time like so:
```java
NItem.create(Material.GOLD_AXE).setItemFlag(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_POTION_EFFECTS).make();
```
#### Overriding Meta
```java
NItem.create(Material.GOLD_AXE).setMeta(meta).make();
```
If you are in need of manually overriding the items ```ItemMeta``` this is also possible. Do note that if any of the other features of ```NItem``` are set that those will overwrite.
#### Coloring
By default all coloring is on. All & color codes will work.
If you would like to disable this howhever you can do one of the following.
```java
NItem.create(Material.GOLD_AXE).setNameColor(false).make();
```
```java
NItem.create(Material.GOLD_AXE).setNameColor(true).make();
```
## Compilation
Build with `mvn clean install`. Do note that you will need the spigot jars in this repo to be installed on your
local repository.
## License
This project is licensed under the [MIT License](LICENSE).