Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions src/main/java/com/darkblade12/itemslotmachine/util/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -54,6 +55,32 @@ public static ItemStack fromString(String text, Map<String, ItemStack> customIte
}
}

if (data.length >= 3) {
try {
String t_name = data[2];
ItemMeta data_ = item.getItemMeta();
data_.setDisplayName(t_name);
item.setItemMeta(data_);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid name value.");
}
}

if (data.length >= 4) {
try {
String lore = data[3];
ItemMeta data_ = item.getItemMeta();
List<String> lores = new ArrayList<String>();
for(String s : lore.split("\n")) {
lores.add(s);
}
data_.setLore(lores);
item.setItemMeta(data_);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid lore value.");
}
}

return item;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ item-pot:
enabled: true

# The default content of the item pot, which will be set after a player has won the pot
# Item format: <item_name>[-<amount>]
# Item format: <item_name>[-<amount>][-<name>][-<lore>]
# The item name 'coin' can be used for a coin item
default: ['feather-5', 'diamond-1', 'iron_ingot-1']

# The items which are added to the pot by every spin
# Item format: <item_name>[-<amount>]
# Item format: <item_name>[-<amount>][-<name>][-<lore>]
# The item name 'coin' can be used for a coin item
raise: ['glowstone_dust-2', 'lapis_lazuli-2']

Expand Down