mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-30 01:13:38 +01:00
Debug skill Tree & Debug PAPI
This commit is contained in:
parent
fe12e07f37
commit
90ee0c37bb
@ -42,6 +42,15 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
if (function.equals("skill-tree")) {
|
||||
return new SkillTreeItem(config);
|
||||
}
|
||||
if (function.equals("up"))
|
||||
return new SimplePlaceholderItem(config);
|
||||
if (function.equals("left"))
|
||||
return new SimplePlaceholderItem(config);
|
||||
if (function.equals("down"))
|
||||
return new SimplePlaceholderItem(config);
|
||||
if (function.equals("right"))
|
||||
return new SimplePlaceholderItem(config);
|
||||
|
||||
if (function.equals("reallocation"))
|
||||
return new InventoryItem<SkillTreeInventory>(config) {
|
||||
|
||||
@ -105,8 +114,7 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
getLore().forEach(string -> {
|
||||
if (string.contains("{tree-lore}")) {
|
||||
lore.addAll(skillTree.getLore());
|
||||
}
|
||||
else
|
||||
} else
|
||||
lore.add(holders.apply(inv.getPlayer(), string));
|
||||
});
|
||||
meta.setLore(lore);
|
||||
@ -323,6 +331,24 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
treeListPage++;
|
||||
open();
|
||||
}
|
||||
if (item.getFunction().equals("up")) {
|
||||
y--;
|
||||
open();
|
||||
|
||||
}
|
||||
if (item.getFunction().equals("right")) {
|
||||
x++;
|
||||
open();
|
||||
}
|
||||
if (item.getFunction().equals("down")) {
|
||||
y++;
|
||||
open();
|
||||
}
|
||||
if (item.getFunction().equals("left")) {
|
||||
x--;
|
||||
open();
|
||||
}
|
||||
|
||||
|
||||
if (item.getFunction().equals("previous-tree-list-page")) {
|
||||
treeListPage--;
|
||||
@ -373,17 +399,7 @@ public class SkillTreeViewer extends EditableInventory {
|
||||
}
|
||||
|
||||
if (item.getFunction().equals("skill-tree-node")) {
|
||||
|
||||
if (event.getClickType() == ClickType.RIGHT) {
|
||||
int offset = event.getSlot();
|
||||
int xOffset = offset % 9 - middleSlot % 9;
|
||||
int yOffset = offset / 9 - middleSlot / 9;
|
||||
x += xOffset;
|
||||
y += yOffset - 1;
|
||||
open();
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
} else if (event.getClickType() == ClickType.LEFT) {
|
||||
if (event.getClickType() == ClickType.LEFT) {
|
||||
PersistentDataContainer container = event.getItemStack().getItemMeta().getPersistentDataContainer();
|
||||
int x = container.get(new NamespacedKey(MMOCore.plugin, "coordinates.x"), PersistentDataType.INTEGER);
|
||||
int y = container.get(new NamespacedKey(MMOCore.plugin, "coordinates.y"), PersistentDataType.INTEGER);
|
||||
|
@ -97,7 +97,8 @@ public class ClassSkill implements CooldownObject {
|
||||
private String applyPlaceholders(Map<String, String> placeholders, String str) {
|
||||
while (str.contains("{") && str.substring(str.indexOf("{")).contains("}")) {
|
||||
String holder = str.substring(str.indexOf("{") + 1, str.indexOf("}"));
|
||||
str = str.replace("{" + holder + "}", placeholders.getOrDefault(holder, "PHE"));
|
||||
if(placeholders.containsKey(holder))
|
||||
str = str.replace("{" + holder + "}",placeholders.get(holder));
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class SkillTreeNode implements Unlockable, ExperienceObject {
|
||||
|
||||
maxLevel = config.contains("max-level") ? config.getInt("max-level") : 1;
|
||||
maxChildren = config.contains("max-children") ? config.getInt("max-children") : 1;
|
||||
//If coordinates are precised adn we are not wiht an automaticTree we set them up
|
||||
//If coordinates are precised adn we are not with an automaticTree we set them up
|
||||
if ((!(tree instanceof AutomaticSkillTree))) {
|
||||
Validate.isTrue(config.contains("coordinates.x") && config.contains("coordinates.y"), "No coordinates specified");
|
||||
coordinates = new IntegerCoordinates(config.getInt("coordinates.x"), config.getInt("coordinates.y"));
|
||||
|
@ -28,19 +28,19 @@ public class AutomaticSkillTree extends SkillTree {
|
||||
|
||||
//We setup the children and parents for each node.
|
||||
for (SkillTreeNode node : nodes.values()) {
|
||||
ConfigurationSection section = config.getConfigurationSection("nodes." + node.getId() + ".children.soft");
|
||||
ConfigurationSection section = config.getConfigurationSection("nodes." + node.getId() + ".parents.soft");
|
||||
if (section != null) {
|
||||
for (String child : section.getKeys(false)) {
|
||||
node.addChild(getNode(child));
|
||||
getNode(child).addParent(node, section.getInt(child), ParentType.SOFT);
|
||||
for (String parent : section.getKeys(false)) {
|
||||
node.addParent(getNode(parent),section.getInt(parent),ParentType.SOFT);
|
||||
getNode(parent).addChild(node);
|
||||
}
|
||||
}
|
||||
section = config.getConfigurationSection("nodes." + node.getId() + ".children.strong");
|
||||
section = config.getConfigurationSection("nodes." + node.getId() + ".parents.strong");
|
||||
|
||||
if (section != null) {
|
||||
for (String child : section.getKeys(false)) {
|
||||
node.addChild(getNode(child));
|
||||
getNode(child).addParent(node, section.getInt(child), ParentType.STRONG);
|
||||
for (String parent : section.getKeys(false)) {
|
||||
node.addParent(getNode(parent),section.getInt(parent),ParentType.STRONG);
|
||||
getNode(parent).addChild(node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,21 +26,18 @@ public class CustomSkillTree extends SkillTree {
|
||||
//We setup the children and parents for each node.
|
||||
for (SkillTreeNode node : nodes.values()) {
|
||||
|
||||
ConfigurationSection section = config.getConfigurationSection("nodes."+node.getId() + ".children.soft");
|
||||
ConfigurationSection section = config.getConfigurationSection("nodes."+node.getId() + ".parents.soft");
|
||||
if (section != null) {
|
||||
for (String child : section.getKeys(false)) {
|
||||
Validate.isTrue(isNode(child),"The node "+child+ "defined in children.soft of"+node.getId()+"doesn't exist.");
|
||||
node.addChild(getNode(child));
|
||||
getNode(child).addParent(node, section.getInt(child), ParentType.SOFT);
|
||||
for (String parent : section.getKeys(false)) {
|
||||
node.addParent(getNode(parent),section.getInt(parent),ParentType.SOFT);
|
||||
getNode(parent).addChild(node);
|
||||
}
|
||||
}
|
||||
section = config.getConfigurationSection("nodes."+node.getId() + ".children.strong");
|
||||
section = config.getConfigurationSection("nodes."+node.getId() + ".parents.strong");
|
||||
if (section != null) {
|
||||
for (String child : section.getKeys(false)) {
|
||||
Validate.isTrue(isNode(child),"The node "+child+ "defined in children.strong of"+node.getId()+"doesn't exist.");
|
||||
|
||||
node.addChild(getNode(child));
|
||||
getNode(child).addParent(node, section.getInt(child), ParentType.STRONG);
|
||||
for (String parent : section.getKeys(false)) {
|
||||
node.addParent(getNode(parent),section.getInt(parent),ParentType.STRONG);
|
||||
getNode(parent).addChild(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
pom.xml
2
pom.xml
@ -16,7 +16,7 @@
|
||||
<description>Offer your players a brand new RPG experience!!</description>
|
||||
|
||||
<properties>
|
||||
<revision>1.10.1-SNAPSHOT</revision>
|
||||
<revision>1.10.2-SNAPSHOT</revision>
|
||||
<downloadSources>false</downloadSources>
|
||||
<downloadJavadocs>false</downloadJavadocs>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
Loading…
Reference in New Issue
Block a user