Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ public class ItemConfiguration {
private ItemRuneConfiguration itemRuneConfiguration;
private Food food;
private ItemRarity itemRarity;
private String tooltipstyle;

public ItemConfiguration(ItemPlugin plugin, YamlConfiguration configuration, String fileName, String path) {

Expand Down Expand Up @@ -262,6 +263,10 @@ public ItemConfiguration(ItemPlugin plugin, YamlConfiguration configuration, Str
if (swappableEquipment && this.equippedModel != null && this.equippedSlot != null) {
this.swappableEquipment = true;
}
String tooltypestyleString = configuration.getString(path + "tooltip-style", null);
if (tooltypestyleString != null) {
this.tooltipstyle = tooltypestyleString;
}

this.loadAxolotl(plugin, configuration, fileName, path);
this.loadBanner(plugin, configuration, fileName, path);
Expand Down Expand Up @@ -649,6 +654,10 @@ public List<Rune> getRunes() {
return runes;
}

public String getTooltipstyle() {
return tooltipstyle;
}

public int getNbRunesView() {
return nbRunesView;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fr.maxlego08.items.api.events;

import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public class ZItemsLoadedEvent extends Event {
private static final HandlerList HANDLERS = new HandlerList();

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}

public static HandlerList getHandlerList() {
return HANDLERS;
}
}
6 changes: 6 additions & 0 deletions src/main/java/fr/maxlego08/items/ZItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ public ItemStack build(Player player, int amount) {
}
itemMeta.setEquippable(equippableComponent);
}
if (this.configuration.getTooltipstyle() != null && !this.configuration.getTooltipstyle().isEmpty()) {
String[] tooltipStyleSplit = this.configuration.getTooltipstyle().split(":", 2);
if (tooltipStyleSplit.length == 2) {
itemMeta.setTooltipStyle(new NamespacedKey(tooltipStyleSplit[0], tooltipStyleSplit[1]));
}
}

this.configuration.applyLeatherArmorMeta(itemMeta);

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/fr/maxlego08/items/ZItemManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import fr.maxlego08.items.api.Item;
import fr.maxlego08.items.api.ItemManager;
import fr.maxlego08.items.api.configurations.ItemConfiguration;
import fr.maxlego08.items.api.events.ZItemsLoadedEvent;
import fr.maxlego08.items.api.utils.ItemFile;
import fr.maxlego08.items.zcore.enums.Message;
import fr.maxlego08.items.zcore.utils.ZUtils;
Expand Down Expand Up @@ -69,6 +70,8 @@ public void loadItems() {


itemFile = ItemFile.fromFolder(folder);
ZItemsLoadedEvent itemsLoadedEvent = new ZItemsLoadedEvent();
this.plugin.getServer().getPluginManager().callEvent(itemsLoadedEvent);
}

@Override
Expand Down