mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2025-01-06 07:07:38 +01:00
Enabled each skillTreeNode to have its own display by filling item & custom-model-data in its config.
This commit is contained in:
parent
50f2de287c
commit
ad6b7fa0ff
@ -345,6 +345,10 @@ public class SkillTreeViewer extends EditableInventory {
|
|||||||
|
|
||||||
if (skillTree.isNode(coordinates)) {
|
if (skillTree.isNode(coordinates)) {
|
||||||
SkillTreeNode node = skillTree.getNode(coordinates);
|
SkillTreeNode node = skillTree.getNode(coordinates);
|
||||||
|
//If the node has its own display, it will be shown.
|
||||||
|
if(node.getItem()!=null)
|
||||||
|
return new Icon(node.getItem(),node.getCustomModelData());
|
||||||
|
|
||||||
NodeType nodeType = NodeType.getNodeType(hasNorthPath, hasEastPath, hasSouthPath, hasWestPath);
|
NodeType nodeType = NodeType.getNodeType(hasNorthPath, hasEastPath, hasSouthPath, hasWestPath);
|
||||||
return icons.get(new NodeDisplayInfo(nodeType, playerData.getNodeState(node)));
|
return icons.get(new NodeDisplayInfo(nodeType, playerData.getNodeState(node)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,6 +11,7 @@ import net.Indyuce.mmocore.gui.api.item.Placeholders;
|
|||||||
import net.Indyuce.mmocore.skilltree.tree.SkillTree;
|
import net.Indyuce.mmocore.skilltree.tree.SkillTree;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
@ -21,6 +22,9 @@ import java.util.*;
|
|||||||
public class SkillTreeNode implements ExperienceObject {
|
public class SkillTreeNode implements ExperienceObject {
|
||||||
private final SkillTree tree;
|
private final SkillTree tree;
|
||||||
private final String name, id;
|
private final String name, id;
|
||||||
|
|
||||||
|
private Material item;
|
||||||
|
private int customModelData;
|
||||||
private IntegerCoordinates coordinates;
|
private IntegerCoordinates coordinates;
|
||||||
/**
|
/**
|
||||||
* The number of skill tree points this node requires.
|
* The number of skill tree points this node requires.
|
||||||
@ -57,6 +61,9 @@ public class SkillTreeNode implements ExperienceObject {
|
|||||||
Validate.notNull(config, "Config cannot be null");
|
Validate.notNull(config, "Config cannot be null");
|
||||||
this.id = config.getName();
|
this.id = config.getName();
|
||||||
this.tree = tree;
|
this.tree = tree;
|
||||||
|
if(config.contains("item"))
|
||||||
|
item = Material.valueOf(config.getString("item"));
|
||||||
|
customModelData= config.getInt("custom-model-data",0);
|
||||||
name = Objects.requireNonNull(config.getString("name"), "Could not find node name");
|
name = Objects.requireNonNull(config.getString("name"), "Could not find node name");
|
||||||
size = Objects.requireNonNull(config.getInt("size"));
|
size = Objects.requireNonNull(config.getInt("size"));
|
||||||
isRoot = config.getBoolean("is-root", false);
|
isRoot = config.getBoolean("is-root", false);
|
||||||
@ -84,6 +91,14 @@ public class SkillTreeNode implements ExperienceObject {
|
|||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Material getItem() {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCustomModelData() {
|
||||||
|
return customModelData;
|
||||||
|
}
|
||||||
|
|
||||||
public void setIsRoot() {
|
public void setIsRoot() {
|
||||||
isRoot = true;
|
isRoot = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user