mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Fixed default item type scripts
This commit is contained in:
parent
22d4a22d38
commit
464daef7a8
@ -36,7 +36,7 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
|
|
||||||
// Blunt
|
// Blunt
|
||||||
public static final Type HAMMER = new Type("HAMMER", true, ModifierSource.MELEE_WEAPON);
|
public static final Type HAMMER = new Type("HAMMER", true, ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type GAUNTLET = new Type("IRON_SHOVEL", true, ModifierSource.MELEE_WEAPON);
|
public static final Type GAUNTLET = new Type("GAUNTLET", true, ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Range
|
// Range
|
||||||
public static final Type WHIP = new Type("WHIP", true, ModifierSource.RANGED_WEAPON);
|
public static final Type WHIP = new Type("WHIP", true, ModifierSource.RANGED_WEAPON);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package net.Indyuce.mmoitems.api.crafting;
|
package net.Indyuce.mmoitems.api.crafting;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.api.util.PostLoadObject;
|
import io.lumine.mythic.lib.util.PostLoadAction;
|
||||||
|
import io.lumine.mythic.lib.util.PreloadedObject;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.IngredientInventory;
|
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.IngredientInventory;
|
||||||
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
||||||
@ -13,12 +14,13 @@ import org.apache.commons.lang.Validate;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class CraftingStation extends PostLoadObject {
|
public class CraftingStation implements PreloadedObject {
|
||||||
private final String id;
|
private final String id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Layout layout;
|
private final Layout layout;
|
||||||
@ -38,8 +40,17 @@ public class CraftingStation extends PostLoadObject {
|
|||||||
|
|
||||||
private CraftingStation parent;
|
private CraftingStation parent;
|
||||||
|
|
||||||
|
private final PostLoadAction postLoadAction = new PostLoadAction(config -> {
|
||||||
|
if (!config.contains("parent")) return;
|
||||||
|
|
||||||
|
String id = config.getString("parent").toLowerCase().replace(" ", "-").replace("_", "-");
|
||||||
|
Validate.isTrue(!id.equals(CraftingStation.this.id), "Station cannot use itself as parent");
|
||||||
|
Validate.isTrue(MMOItems.plugin.getCrafting().hasStation(id), "Could not find parent station with ID '" + id + "'");
|
||||||
|
parent = MMOItems.plugin.getCrafting().getStation(id);
|
||||||
|
});
|
||||||
|
|
||||||
public CraftingStation(String id, FileConfiguration config) {
|
public CraftingStation(String id, FileConfiguration config) {
|
||||||
super(config);
|
postLoadAction.cacheConfig(config);
|
||||||
|
|
||||||
this.id = id.toLowerCase().replace("_", "-").replace(" ", "-");
|
this.id = id.toLowerCase().replace("_", "-").replace(" ", "-");
|
||||||
this.name = config.getString("name", "Unnamed");
|
this.name = config.getString("name", "Unnamed");
|
||||||
@ -59,8 +70,6 @@ public class CraftingStation extends PostLoadObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CraftingStation(String id, String name, Layout layout, Sound sound, StationItemOptions itemOptions, int maxQueueSize, CraftingStation parent) {
|
public CraftingStation(String id, String name, Layout layout, Sound sound, StationItemOptions itemOptions, int maxQueueSize, CraftingStation parent) {
|
||||||
super(null);
|
|
||||||
|
|
||||||
Validate.notNull(id, "Crafting station ID must not be null");
|
Validate.notNull(id, "Crafting station ID must not be null");
|
||||||
Validate.notNull(name, "Crafting station name must not be null");
|
Validate.notNull(name, "Crafting station name must not be null");
|
||||||
Validate.notNull(sound, "Crafting station sound must not be null");
|
Validate.notNull(sound, "Crafting station sound must not be null");
|
||||||
@ -74,6 +83,12 @@ public class CraftingStation extends PostLoadObject {
|
|||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public PostLoadAction getPostLoadAction() {
|
||||||
|
return postLoadAction;
|
||||||
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -169,16 +184,6 @@ public class CraftingStation extends PostLoadObject {
|
|||||||
return Math.max(1, (int) Math.ceil((double) recipes / getLayout().getRecipeSlots().size()));
|
return Math.max(1, (int) Math.ceil((double) recipes / getLayout().getRecipeSlots().size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void whenPostLoaded(ConfigurationSection config) {
|
|
||||||
if (config.contains("parent")) {
|
|
||||||
String id = config.getString("parent").toLowerCase().replace(" ", "-").replace("_", "-");
|
|
||||||
Validate.isTrue(!id.equals(this.id), "Station cannot use itself as parent");
|
|
||||||
Validate.isTrue(MMOItems.plugin.getCrafting().hasStation(id), "Could not find parent station with ID '" + id + "'");
|
|
||||||
parent = MMOItems.plugin.getCrafting().getStation(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find type of crafting recipe based on section. there is no 'type' recipe
|
* find type of crafting recipe based on section. there is no 'type' recipe
|
||||||
* parameter because old files would be out of date, instead just looks for
|
* parameter because old files would be out of date, instead just looks for
|
||||||
|
@ -7,7 +7,6 @@ import io.lumine.mythic.lib.comp.flags.CustomFlag;
|
|||||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||||
import io.lumine.mythic.lib.skill.SimpleSkill;
|
import io.lumine.mythic.lib.skill.SimpleSkill;
|
||||||
import io.lumine.mythic.lib.skill.Skill;
|
|
||||||
import io.lumine.mythic.lib.skill.SkillMetadata;
|
import io.lumine.mythic.lib.skill.SkillMetadata;
|
||||||
import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||||
import io.lumine.mythic.lib.skill.result.SkillResult;
|
import io.lumine.mythic.lib.skill.result.SkillResult;
|
||||||
@ -23,6 +22,7 @@ import net.Indyuce.mmoitems.api.interaction.util.UntargetedDurabilityItem;
|
|||||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.LegacyWeapon;
|
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.LegacyWeapon;
|
||||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||||
|
import net.Indyuce.mmoitems.stat.ActionLeftClick;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -134,7 +134,12 @@ public class Weapon extends UseItem {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private SkillHandler findClickSkill(boolean rightClick) {
|
private SkillHandler findClickSkill(boolean rightClick) {
|
||||||
final String skillId = getNBTItem().getString((rightClick ? ItemStats.RIGHT_CLICK_SCRIPT : ItemStats.LEFT_CLICK_SCRIPT).getNBTPath());
|
String skillId = getNBTItem().getString((rightClick ? ItemStats.RIGHT_CLICK_SCRIPT : ItemStats.LEFT_CLICK_SCRIPT).getNBTPath());
|
||||||
|
|
||||||
|
// (Deprecated) Support for staff spirits on left-clicks
|
||||||
|
if (!rightClick && (skillId == null || skillId.isEmpty()))
|
||||||
|
skillId = getNBTItem().getString(ActionLeftClick.LEGACY_PATH);
|
||||||
|
|
||||||
if (skillId == null || skillId.isEmpty()) {
|
if (skillId == null || skillId.isEmpty()) {
|
||||||
|
|
||||||
// Find item type action
|
// Find item type action
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package net.Indyuce.mmoitems.api.item.template;
|
package net.Indyuce.mmoitems.api.item.template;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.api.util.PostLoadObject;
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
||||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||||
|
import io.lumine.mythic.lib.util.PostLoadAction;
|
||||||
|
import io.lumine.mythic.lib.util.PreloadedObject;
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.ItemTier;
|
import net.Indyuce.mmoitems.api.ItemTier;
|
||||||
import net.Indyuce.mmoitems.api.Type;
|
import net.Indyuce.mmoitems.api.Type;
|
||||||
@ -25,7 +27,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class MMOItemTemplate extends PostLoadObject implements ItemReference {
|
public class MMOItemTemplate implements ItemReference, PreloadedObject {
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private final String id;
|
private final String id;
|
||||||
private final int revId;
|
private final int revId;
|
||||||
@ -42,40 +44,7 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference {
|
|||||||
private ModifierGroup modifierGroup;
|
private ModifierGroup modifierGroup;
|
||||||
private final Set<TemplateOption> options = new HashSet<>();
|
private final Set<TemplateOption> options = new HashSet<>();
|
||||||
|
|
||||||
/**
|
private final PostLoadAction postLoadAction = new PostLoadAction(config -> {
|
||||||
* Public constructor which can be used to register extra item templates
|
|
||||||
* using other addons or plugins
|
|
||||||
*
|
|
||||||
* @param type The item type of your template
|
|
||||||
* @param id The template identifier, it's ok if two templates with
|
|
||||||
* different item types share the same ID
|
|
||||||
*/
|
|
||||||
public MMOItemTemplate(Type type, String id) {
|
|
||||||
super(null);
|
|
||||||
|
|
||||||
this.type = type;
|
|
||||||
this.id = id;
|
|
||||||
this.revId = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to load MMOItem templates from config files
|
|
||||||
*
|
|
||||||
* @param type The item type of your template
|
|
||||||
* @param config The config file read to load the template
|
|
||||||
*/
|
|
||||||
public MMOItemTemplate(Type type, ConfigurationSection config) {
|
|
||||||
super(config);
|
|
||||||
Validate.notNull(config, "Could not load template config");
|
|
||||||
|
|
||||||
this.type = type;
|
|
||||||
this.id = config.getName().toUpperCase().replace("-", "_").replace(" ", "_");
|
|
||||||
this.revId = config.getInt("base.revision-id", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void whenPostLoaded(ConfigurationSection config) {
|
|
||||||
|
|
||||||
FriendlyFeedbackProvider ffp = new FriendlyFeedbackProvider(FFPMMOItems.get());
|
FriendlyFeedbackProvider ffp = new FriendlyFeedbackProvider(FFPMMOItems.get());
|
||||||
ffp.activatePrefix(true, getType().getId() + " " + getId());
|
ffp.activatePrefix(true, getType().getId() + " " + getId());
|
||||||
|
|
||||||
@ -95,7 +64,7 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference {
|
|||||||
|
|
||||||
// Read modifiers
|
// Read modifiers
|
||||||
try {
|
try {
|
||||||
modifierGroup = config.contains("modifiers") ? new ModifierGroup(id, config) : null;
|
modifierGroup = config.contains("modifiers") ? new ModifierGroup(getId(), config) : null;
|
||||||
if (modifierGroup != null) modifierGroup.getPostLoadAction().performAction();
|
if (modifierGroup != null) modifierGroup.getPostLoadAction().performAction();
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
ffp.log(FriendlyFeedbackCategory.ERROR, "Could not load modifier group: {0}", exception.getMessage());
|
ffp.log(FriendlyFeedbackCategory.ERROR, "Could not load modifier group: {0}", exception.getMessage());
|
||||||
@ -105,10 +74,9 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference {
|
|||||||
Validate.notNull(config.getConfigurationSection("base"), FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), "Could not find base item data"));
|
Validate.notNull(config.getConfigurationSection("base"), FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), "Could not find base item data"));
|
||||||
for (String key : config.getConfigurationSection("base").getKeys(false))
|
for (String key : config.getConfigurationSection("base").getKeys(false))
|
||||||
try {
|
try {
|
||||||
String id = key.toUpperCase().replace("-", "_");
|
final String id = UtilityMethods.enumName(key);
|
||||||
Validate.isTrue(MMOItems.plugin.getStats().has(id), FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), "Could not find stat with ID '$i{0}$b'", id));
|
final ItemStat stat = MMOItems.plugin.getStats().get(id);
|
||||||
|
Validate.notNull(stat, FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), "Could not find stat with ID '$i{0}$b'", id));
|
||||||
ItemStat stat = MMOItems.plugin.getStats().get(id);
|
|
||||||
RandomStatData data = stat.whenInitialized(config.get("base." + key));
|
RandomStatData data = stat.whenInitialized(config.get("base." + key));
|
||||||
if (data != null)
|
if (data != null)
|
||||||
base.put(stat, data);
|
base.put(stat, data);
|
||||||
@ -121,6 +89,42 @@ public class MMOItemTemplate extends PostLoadObject implements ItemReference {
|
|||||||
|
|
||||||
// Print all failures
|
// Print all failures
|
||||||
ffp.sendTo(FriendlyFeedbackCategory.INFORMATION, MMOItems.getConsole());
|
ffp.sendTo(FriendlyFeedbackCategory.INFORMATION, MMOItems.getConsole());
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public constructor which can be used to register extra item templates
|
||||||
|
* using other addons or plugins
|
||||||
|
*
|
||||||
|
* @param type The item type of your template
|
||||||
|
* @param id The template identifier, it's ok if two templates with
|
||||||
|
* different item types share the same ID
|
||||||
|
*/
|
||||||
|
public MMOItemTemplate(Type type, String id) {
|
||||||
|
this.type = type;
|
||||||
|
this.id = id;
|
||||||
|
this.revId = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used to load MMOItem templates from config files
|
||||||
|
*
|
||||||
|
* @param type The item type of your template
|
||||||
|
* @param config The config file read to load the template
|
||||||
|
*/
|
||||||
|
public MMOItemTemplate(Type type, ConfigurationSection config) {
|
||||||
|
Validate.notNull(config, "Could not load template config");
|
||||||
|
|
||||||
|
postLoadAction.cacheConfig(config);
|
||||||
|
|
||||||
|
this.type = type;
|
||||||
|
this.id = config.getName().toUpperCase().replace("-", "_").replace(" ", "_");
|
||||||
|
this.revId = config.getInt("base.revision-id", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Override
|
||||||
|
public PostLoadAction getPostLoadAction() {
|
||||||
|
return postLoadAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.Indyuce.mmoitems.api.item.template;
|
package net.Indyuce.mmoitems.api.item.template;
|
||||||
|
|
||||||
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import io.lumine.mythic.lib.util.PostLoadAction;
|
import io.lumine.mythic.lib.util.PostLoadAction;
|
||||||
import io.lumine.mythic.lib.util.PreloadedObject;
|
|
||||||
import net.Indyuce.mmoitems.MMOItems;
|
import net.Indyuce.mmoitems.MMOItems;
|
||||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||||
@ -22,7 +22,7 @@ public class TemplateModifier extends ModifierNode {
|
|||||||
Validate.notNull(config.getConfigurationSection("stats"), "Could not find base item data");
|
Validate.notNull(config.getConfigurationSection("stats"), "Could not find base item data");
|
||||||
for (String key : config.getConfigurationSection("stats").getKeys(false))
|
for (String key : config.getConfigurationSection("stats").getKeys(false))
|
||||||
try {
|
try {
|
||||||
final String statId = key.toUpperCase().replace("-", "_");
|
final String statId = UtilityMethods.enumName(key);
|
||||||
final ItemStat stat = MMOItems.plugin.getStats().get(statId);
|
final ItemStat stat = MMOItems.plugin.getStats().get(statId);
|
||||||
Validate.notNull(stat, "Could not find stat with ID '" + statId + "'");
|
Validate.notNull(stat, "Could not find stat with ID '" + statId + "'");
|
||||||
TemplateModifier.this.data.put(stat, stat.whenInitialized(config.get("stats." + key)));
|
TemplateModifier.this.data.put(stat, stat.whenInitialized(config.get("stats." + key)));
|
||||||
|
@ -109,7 +109,7 @@ public class CraftingManager implements Reloadable {
|
|||||||
|
|
||||||
for (CraftingStation station : stations.values())
|
for (CraftingStation station : stations.values())
|
||||||
try {
|
try {
|
||||||
station.postLoad();
|
station.getPostLoadAction().performAction();
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
MMOItems.plugin.getLogger().log(Level.WARNING,
|
MMOItems.plugin.getLogger().log(Level.WARNING,
|
||||||
"Could not post-load station '" + station.getId() + "': " + exception.getMessage());
|
"Could not post-load station '" + station.getId() + "': " + exception.getMessage());
|
||||||
|
@ -172,7 +172,7 @@ public class TemplateManager implements Reloadable {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
MMOItemTemplate template = new MMOItemTemplate(type, type.getConfigFile().getConfig().getConfigurationSection(id));
|
MMOItemTemplate template = new MMOItemTemplate(type, type.getConfigFile().getConfig().getConfigurationSection(id));
|
||||||
template.postLoad();
|
template.getPostLoadAction().performAction();
|
||||||
registerTemplate(template);
|
registerTemplate(template);
|
||||||
return template;
|
return template;
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ public class TemplateManager implements Reloadable {
|
|||||||
ffp.log(FriendlyFeedbackCategory.INFORMATION, "Loading item templates, please wait...");
|
ffp.log(FriendlyFeedbackCategory.INFORMATION, "Loading item templates, please wait...");
|
||||||
templates.forEach(template -> {
|
templates.forEach(template -> {
|
||||||
try {
|
try {
|
||||||
template.postLoad();
|
template.getPostLoadAction().performAction();
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
ffp.activatePrefix(true, "Item Templates \u00a78($r" + template.getType().getId() + "\u00a78)");
|
ffp.activatePrefix(true, "Item Templates \u00a78($r" + template.getType().getId() + "\u00a78)");
|
||||||
ffp.log(FriendlyFeedbackCategory.INFORMATION, "Could not post-load item template '" + template.getId() + "': " + exception.getMessage());
|
ffp.log(FriendlyFeedbackCategory.INFORMATION, "Could not post-load item template '" + template.getId() + "': " + exception.getMessage());
|
||||||
|
@ -12,7 +12,6 @@ import net.Indyuce.mmoitems.stat.data.StringData;
|
|||||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ public class ActionLeftClick extends StringStat {
|
|||||||
super("ON_LEFT_CLICK", Material.COMMAND_BLOCK_MINECART, "Left Click Action", new String[]{"ID of skill ran when left clicking. When used,", "The item will naturally apply item costs like", "mana, stamina, cooldown. This option overrides the", "script provided by the item type."}, new String[]{"weapon"});
|
super("ON_LEFT_CLICK", Material.COMMAND_BLOCK_MINECART, "Left Click Action", new String[]{"ID of skill ran when left clicking. When used,", "The item will naturally apply item costs like", "mana, stamina, cooldown. This option overrides the", "script provided by the item type."}, new String[]{"weapon"});
|
||||||
|
|
||||||
// Staff spirit set as alias
|
// Staff spirit set as alias
|
||||||
setAliases(LEGACY_PATH);
|
setAliases(LEGACY_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -39,44 +38,25 @@ public class ActionLeftClick extends StringStat {
|
|||||||
// No lore insertion
|
// No lore insertion
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String LEGACY_PATH = "STAFF_SPIRIT";
|
public static final String LEGACY_ID = "STAFF_SPIRIT";
|
||||||
|
public static final String LEGACY_PATH = "MMOITEMS_" + LEGACY_ID;
|
||||||
|
|
||||||
// TODO refactor with stat categories
|
// TODO refactor with stat categories
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
||||||
ArrayList<ItemTag> relevantTags = new ArrayList<>();
|
ArrayList<ItemTag> relevantTags = new ArrayList<>();
|
||||||
|
|
||||||
// New path
|
// New path
|
||||||
if (mmoitem.getNBT().hasTag(getNBTPath()))
|
if (mmoitem.getNBT().hasTag(getNBTPath()))
|
||||||
relevantTags.add(ItemTag.getTagAtPath(getNBTPath(), mmoitem.getNBT(), SupportedNBTTagValues.STRING));
|
relevantTags.add(ItemTag.getTagAtPath(getNBTPath(), mmoitem.getNBT(), SupportedNBTTagValues.STRING));
|
||||||
|
|
||||||
// Legacy path
|
// Legacy path
|
||||||
if (mmoitem.getNBT().hasTag(LEGACY_PATH))
|
if (mmoitem.getNBT().hasTag(LEGACY_PATH))
|
||||||
relevantTags.add(ItemTag.getTagAtPath(LEGACY_PATH, mmoitem.getNBT(), SupportedNBTTagValues.STRING));
|
relevantTags.add(new ItemTag(getNBTPath(), ItemTag.getTagAtPath(LEGACY_PATH, mmoitem.getNBT(), SupportedNBTTagValues.STRING).getValue()));
|
||||||
|
|
||||||
StringData bakedData = getLoadedNBT(relevantTags);
|
StringData bakedData = getLoadedNBT(relevantTags);
|
||||||
if (bakedData != null) mmoitem.setData(this, bakedData);
|
if (bakedData != null) mmoitem.setData(this, bakedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO refactor with stat categories
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
@Deprecated
|
|
||||||
public StringData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
|
|
||||||
|
|
||||||
// New path
|
|
||||||
ItemTag tg = ItemTag.getTagAtPath(getNBTPath(), storedTags);
|
|
||||||
if (tg != null) {
|
|
||||||
String value = (String) tg.getValue();
|
|
||||||
return new StringData(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Legacy path
|
|
||||||
tg = ItemTag.getTagAtPath(LEGACY_PATH, storedTags);
|
|
||||||
if (tg != null) {
|
|
||||||
String value = (String) tg.getValue();
|
|
||||||
return new StringData(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ HAMMER:
|
|||||||
on-attack: blunt_attack_effect
|
on-attack: blunt_attack_effect
|
||||||
|
|
||||||
GAUNTLET:
|
GAUNTLET:
|
||||||
display: IRON_HORSE_ARMOR
|
display: IRON_SHOVEL
|
||||||
name: 'Gauntlet'
|
name: 'Gauntlet'
|
||||||
unident-item:
|
unident-item:
|
||||||
name: '&f#prefix#Unidentified Gauntlet'
|
name: '&f#prefix#Unidentified Gauntlet'
|
||||||
@ -109,7 +109,7 @@ WHIP:
|
|||||||
- '{tier}&8- &7Item Tier: #prefix##tier#'
|
- '{tier}&8- &7Item Tier: #prefix##tier#'
|
||||||
|
|
||||||
disable-melee-attacks: true
|
disable-melee-attacks: true
|
||||||
on-left-click: whip_attack_effect
|
on-left-click: whip_attack
|
||||||
on-attack: slashing_attack_effect
|
on-attack: slashing_attack_effect
|
||||||
|
|
||||||
STAFF:
|
STAFF:
|
||||||
|
Loading…
Reference in New Issue
Block a user