mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-03 06:37:47 +01:00
Catalysts can now be upgraded
This commit is contained in:
parent
becb9667af
commit
e091b0d3f8
@ -52,7 +52,7 @@ public class ItemStats {
|
|||||||
DISABLE_ENCHANTING = new DisableStat("ENCHANTING", VersionMaterial.ENCHANTING_TABLE.toMaterial(), "Disable Enchanting", new String[]{"!block", "all"}, "Players can't enchant this item."),
|
DISABLE_ENCHANTING = new DisableStat("ENCHANTING", VersionMaterial.ENCHANTING_TABLE.toMaterial(), "Disable Enchanting", new String[]{"!block", "all"}, "Players can't enchant this item."),
|
||||||
DISABLE_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing", new String[]{"!block", "all"}, "Players can't use this item in anvils."),
|
DISABLE_REPAIRING = new DisableStat("REPAIRING", Material.ANVIL, "Disable Repairing", new String[]{"!block", "all"}, "Players can't use this item in anvils."),
|
||||||
DISABLE_ARROW_SHOOTING = new DisableStat("ARROW_SHOOTING", Material.ARROW, "Disable Arrow Shooting", new Material[]{Material.ARROW}, "Players can't shoot this", "item using a bow."),
|
DISABLE_ARROW_SHOOTING = new DisableStat("ARROW_SHOOTING", Material.ARROW, "Disable Arrow Shooting", new Material[]{Material.ARROW}, "Players can't shoot this", "item using a bow."),
|
||||||
DISABLE_DROP = new DisableStat("DROPING", Material.LAVA_BUCKET, "Disable Item Dropping", new String[]{"all"}, "Disables the dropping of this item!"),
|
DISABLE_DROP = new DisableStat("DROPING", Material.LAVA_BUCKET, "Disable Item Dropping", new String[0], "Disables the dropping of this item!"),
|
||||||
DISABLE_ARROW_CONSUMPTION = new DisableStat("ARROW_CONSUMPTION", Material.ARROW, "Disable Arrow Consumption", new String[]{"crossbow"}, "Disable arrow requirement and consumption."),
|
DISABLE_ARROW_CONSUMPTION = new DisableStat("ARROW_CONSUMPTION", Material.ARROW, "Disable Arrow Consumption", new String[]{"crossbow"}, "Disable arrow requirement and consumption."),
|
||||||
|
|
||||||
// Special item interactions/skills
|
// Special item interactions/skills
|
||||||
@ -82,8 +82,8 @@ public class ItemStats {
|
|||||||
STAMINA_COST = new DoubleStat("STAMINA_COST", VersionMaterial.LIGHT_GRAY_DYE.toMaterial(), "Stamina Cost", new String[]{"Stamina spent by your weapon to be used."}, new String[]{"weapon"}),
|
STAMINA_COST = new DoubleStat("STAMINA_COST", VersionMaterial.LIGHT_GRAY_DYE.toMaterial(), "Stamina Cost", new String[]{"Stamina spent by your weapon to be used."}, new String[]{"weapon"}),
|
||||||
ARROW_VELOCITY = new DoubleStat("ARROW_VELOCITY", Material.ARROW, "Arrow Velocity", new String[]{"Determines how far your", "weapon can shoot.", "Default: 1.0"}, new String[]{"gem_stone", "bow", "crossbow"}),
|
ARROW_VELOCITY = new DoubleStat("ARROW_VELOCITY", Material.ARROW, "Arrow Velocity", new String[]{"Determines how far your", "weapon can shoot.", "Default: 1.0"}, new String[]{"gem_stone", "bow", "crossbow"}),
|
||||||
ARROW_POTION_EFFECTS = new ArrowPotionEffects(),
|
ARROW_POTION_EFFECTS = new ArrowPotionEffects(),
|
||||||
PVE_DAMAGE = new DoubleStat("PVE_DAMAGE", VersionMaterial.PORKCHOP.toMaterial(), "PvE Damage", new String[]{"Additional damage against", "non human entities in %."}, new String[]{"weapon", "catalyst", "off_catalyst", "main_catalyst", "tool", "armor", "gem_stone", "accessory"}),
|
PVE_DAMAGE = new DoubleStat("PVE_DAMAGE", VersionMaterial.PORKCHOP.toMaterial(), "PvE Damage", new String[]{"Additional damage against", "non human entities in %."}, new String[]{"equipment", "gem_stone"}),
|
||||||
PVP_DAMAGE = new DoubleStat("PVP_DAMAGE", VersionMaterial.SKELETON_SKULL.toMaterial(), "PvP Damage", new String[]{"Additional damage", "against players in %."}, new String[]{"weapon", "catalyst", "off_catalyst", "main_catalyst", "tool", "armor", "gem_stone", "accessory"}),
|
PVP_DAMAGE = new DoubleStat("PVP_DAMAGE", VersionMaterial.SKELETON_SKULL.toMaterial(), "PvP Damage", new String[]{"Additional damage", "against players in %."}, new String[]{"equipment", "gem_stone"}),
|
||||||
BLUNT_POWER = new DoubleStat("BLUNT_POWER", Material.IRON_AXE, "Blunt Power", new String[]{"The radius of the AoE attack.", "If set to 2.0, enemies within 2 blocks", "around your target will take damage.", "&9This stat only applies to Blunt weapons."}, new String[]{"weapon", "gem_stone"}),
|
BLUNT_POWER = new DoubleStat("BLUNT_POWER", Material.IRON_AXE, "Blunt Power", new String[]{"The radius of the AoE attack.", "If set to 2.0, enemies within 2 blocks", "around your target will take damage.", "&9This stat only applies to Blunt weapons."}, new String[]{"weapon", "gem_stone"}),
|
||||||
BLUNT_RATING = new DoubleStat("BLUNT_RATING", Material.BRICK, "Blunt Rating", new String[]{"The force of the blunt attack.", "If set to 50%, enemies hit by the attack", "will take 50% of the initial damage.", "&9This stat only applies to Blunt weapons."}, new String[]{"weapon", "gem_stone"}),
|
BLUNT_RATING = new DoubleStat("BLUNT_RATING", Material.BRICK, "Blunt Rating", new String[]{"The force of the blunt attack.", "If set to 50%, enemies hit by the attack", "will take 50% of the initial damage.", "&9This stat only applies to Blunt weapons."}, new String[]{"weapon", "gem_stone"}),
|
||||||
WEAPON_DAMAGE = new DoubleStat("WEAPON_DAMAGE", Material.IRON_SWORD, "Weapon Damage", new String[]{"Additional on-hit weapon damage in %."}),
|
WEAPON_DAMAGE = new DoubleStat("WEAPON_DAMAGE", Material.IRON_SWORD, "Weapon Damage", new String[]{"Additional on-hit weapon damage in %."}),
|
||||||
@ -115,7 +115,7 @@ public class ItemStats {
|
|||||||
MAX_MANA = new DoubleStat("MAX_MANA", VersionMaterial.LAPIS_LAZULI.toMaterial(), "Max Mana", new String[]{"Adds mana to your max mana bar."}),
|
MAX_MANA = new DoubleStat("MAX_MANA", VersionMaterial.LAPIS_LAZULI.toMaterial(), "Max Mana", new String[]{"Adds mana to your max mana bar."}),
|
||||||
KNOCKBACK_RESISTANCE = new KnockbackResistance(),
|
KNOCKBACK_RESISTANCE = new KnockbackResistance(),
|
||||||
MOVEMENT_SPEED = new MovementSpeed(),
|
MOVEMENT_SPEED = new MovementSpeed(),
|
||||||
TWO_HANDED = new BooleanStat("TWO_HANDED", Material.IRON_INGOT, "Two Handed", new String[]{"If set to true, a player will be", "significantly slower if holding two", "items, one being Two Handed."}, new String[]{"weapon", "catalyst", "off_catalyst", "main_catalyst", "tool"}),
|
TWO_HANDED = new BooleanStat("TWO_HANDED", Material.IRON_INGOT, "Two Handed", new String[]{"If set to true, a player will be", "significantly slower if holding two", "items, one being Two Handed."}, new String[]{"handheld"}),
|
||||||
REQUIRED_BIOMES = new RequiredBiomes(),
|
REQUIRED_BIOMES = new RequiredBiomes(),
|
||||||
DROP_ON_DEATH = new DisableDeathDrop(),
|
DROP_ON_DEATH = new DisableDeathDrop(),
|
||||||
DURABILITY_BAR = new DurabilityBar(),
|
DURABILITY_BAR = new DurabilityBar(),
|
||||||
@ -150,7 +150,7 @@ public class ItemStats {
|
|||||||
// Crafting Stats
|
// Crafting Stats
|
||||||
CRAFTING = new Crafting(),
|
CRAFTING = new Crafting(),
|
||||||
CRAFT_PERMISSION = new CraftingPermission(),
|
CRAFT_PERMISSION = new CraftingPermission(),
|
||||||
//CRAFT_AMOUNT = new DoubleStat("CRAFTED_AMOUNT", Material.WOODEN_AXE, "Crafted Amount", new String[]{"The stack count for", "this item when crafted."}, new String[]{"all"}),
|
//CRAFT_AMOUNT = new DoubleStat("CRAFTED_AMOUNT", Material.WOODEN_AXE, "Crafted Amount", new String[]{"The stack count for", "this item when crafted."}, new String[0]),
|
||||||
|
|
||||||
// Unique Stats
|
// Unique Stats
|
||||||
AUTOSMELT = new BooleanStat("AUTOSMELT", Material.COAL, "Autosmelt", new String[]{"If set to true, your tool will", "automaticaly smelt mined ores."}, new String[]{"tool"}),
|
AUTOSMELT = new BooleanStat("AUTOSMELT", Material.COAL, "Autosmelt", new String[]{"If set to true, your tool will", "automaticaly smelt mined ores."}, new String[]{"tool"}),
|
||||||
@ -163,7 +163,7 @@ public class ItemStats {
|
|||||||
LUTE_ATTACK_SOUND = new LuteAttackSoundStat(),
|
LUTE_ATTACK_SOUND = new LuteAttackSoundStat(),
|
||||||
LUTE_ATTACK_EFFECT = new LuteAttackEffectStat(),
|
LUTE_ATTACK_EFFECT = new LuteAttackEffectStat(),
|
||||||
NOTE_WEIGHT = new DoubleStat("NOTE_WEIGHT", VersionMaterial.MUSIC_DISC_MALL.toMaterial(), "Note Weight", new String[]{"Defines how the projectile cast", "by your lute tilts downwards."}, new String[]{"lute"}),
|
NOTE_WEIGHT = new DoubleStat("NOTE_WEIGHT", VersionMaterial.MUSIC_DISC_MALL.toMaterial(), "Note Weight", new String[]{"Defines how the projectile cast", "by your lute tilts downwards."}, new String[]{"lute"}),
|
||||||
REMOVE_ON_CRAFT = new BooleanStat("REMOVE_ON_CRAFT", Material.GLASS_BOTTLE, "Remove on Craft", new String[]{"If the item should be completely", "removed when used in a recipe,", "or if it should become an", "empty bottle or bucket."}, new String[]{"all"}, Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.MILK_BUCKET, Material.LAVA_BUCKET, Material.WATER_BUCKET),
|
REMOVE_ON_CRAFT = new BooleanStat("REMOVE_ON_CRAFT", Material.GLASS_BOTTLE, "Remove on Craft", new String[]{"If the item should be completely", "removed when used in a recipe,", "or if it should become an", "empty bottle or bucket."}, new String[0], Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.MILK_BUCKET, Material.LAVA_BUCKET, Material.WATER_BUCKET),
|
||||||
COMPATIBLE_TYPES = new CompatibleTypes(),
|
COMPATIBLE_TYPES = new CompatibleTypes(),
|
||||||
COMPATIBLE_IDS = new CompatibleIds(),
|
COMPATIBLE_IDS = new CompatibleIds(),
|
||||||
COMPATIBLE_MATERIALS = new CompatibleMaterials(),
|
COMPATIBLE_MATERIALS = new CompatibleMaterials(),
|
||||||
@ -183,9 +183,9 @@ public class ItemStats {
|
|||||||
// Abilities & Upgrading
|
// Abilities & Upgrading
|
||||||
ABILITIES = new Abilities(),
|
ABILITIES = new Abilities(),
|
||||||
UPGRADE = new UpgradeStat(),
|
UPGRADE = new UpgradeStat(),
|
||||||
DOWNGRADE_ON_BREAK = new BooleanStat("BREAK_DOWNGRADE", Material.DAMAGED_ANVIL, "Downgrade when Broken", new String[]{"If this item's durability reaches 0,", "it will be fully repaired but also", "downgraded by one level.", "", "&cIt will only break if it cannot be", "&cdowngraded further", "", "Requires to define an &6Upgrade Template", "Required to define &6Custom Durability"}, new String[]{"weapon", "catalyst", "off_catalyst", "main_catalyst", "tool", "armor", "consumable", "accessory"}),
|
DOWNGRADE_ON_BREAK = new BooleanStat("BREAK_DOWNGRADE", Material.DAMAGED_ANVIL, "Downgrade when Broken", new String[]{"If this item's durability reaches 0,", "it will be fully repaired but also", "downgraded by one level.", "", "&cIt will only break if it cannot be", "&cdowngraded further", "", "Requires to define an &6Upgrade Template", "Required to define &6Custom Durability"}, new String[]{"equipment"}),
|
||||||
DOWNGRADE_ON_DEATH = new BooleanStat("DEATH_DOWNGRADE", Material.DAMAGED_ANVIL, "Downgrade on Death", new String[]{"If the wearer of this item dies, it may", "downgrade (based on &6Death Downgrade", "&6Chance &7stat)", "", "Required to define an &6Upgrade Template", "Requires keep-inventory gamerule. "}, new String[]{"weapon", "catalyst", "off_catalyst", "main_catalyst", "tool", "armor", "consumable", "accessory"}),
|
DOWNGRADE_ON_DEATH = new BooleanStat("DEATH_DOWNGRADE", Material.DAMAGED_ANVIL, "Downgrade on Death", new String[]{"If the wearer of this item dies, it may", "downgrade (based on &6Death Downgrade", "&6Chance &7stat)", "", "Required to define an &6Upgrade Template", "Requires keep-inventory gamerule. "}, new String[]{"equipment"}),
|
||||||
DOWNGRADE_ON_DEATH_CHANCE = new DoubleStat("DEATH_DOWNGRADE_CHANCE", Material.SKELETON_SKULL, "Death Downgrade Chance", new String[]{"Probability that an item with &cDowngrade ", "&con Death&7 will be downgraded when the", "player dies. ", "", "Exceeding 100% will for sure downgrade", "one item, and roll again to downgrade", "another (with the excess probability).", "&6The same item wont be downgraded twice."}, new String[]{"!miscellaneous", "!block", "all"}, false),
|
DOWNGRADE_ON_DEATH_CHANCE = new DoubleStat("DEATH_DOWNGRADE_CHANCE", Material.SKELETON_SKULL, "Death Downgrade Chance", new String[]{"Probability that an item with &cDowngrade ", "&con Death&7 will be downgraded when the", "player dies. ", "", "Exceeding 100% will for sure downgrade", "one item, and roll again to downgrade", "another (with the excess probability).", "&6The same item wont be downgraded twice."}, new String[]{"equipment"}, false),
|
||||||
|
|
||||||
// Unique Item Stats
|
// Unique Item Stats
|
||||||
DYE_COLOR = new DyeColor(),
|
DYE_COLOR = new DyeColor(),
|
||||||
|
@ -28,45 +28,44 @@ import java.util.Objects;
|
|||||||
public class Type implements CooldownObject, PreloadedObject {
|
public class Type implements CooldownObject, PreloadedObject {
|
||||||
|
|
||||||
// Slashing
|
// Slashing
|
||||||
public static final Type SWORD = new Type("SWORD", true, ModifierSource.MELEE_WEAPON);
|
public static final Type SWORD = new Type("SWORD", ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Piercing
|
// Piercing
|
||||||
public static final Type DAGGER = new Type("DAGGER", true, ModifierSource.MELEE_WEAPON);
|
public static final Type DAGGER = new Type("DAGGER", ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type SPEAR = new Type("SPEAR", true, ModifierSource.MELEE_WEAPON);
|
public static final Type SPEAR = new Type("SPEAR", ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Blunt
|
// Blunt
|
||||||
public static final Type HAMMER = new Type("HAMMER", true, ModifierSource.MELEE_WEAPON);
|
public static final Type HAMMER = new Type("HAMMER", ModifierSource.MELEE_WEAPON);
|
||||||
public static final Type GAUNTLET = new Type("GAUNTLET", true, ModifierSource.MELEE_WEAPON);
|
public static final Type GAUNTLET = new Type("GAUNTLET", 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", ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type STAFF = new Type("STAFF", true, ModifierSource.RANGED_WEAPON);
|
public static final Type STAFF = new Type("STAFF", ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type BOW = new Type("BOW", true, ModifierSource.RANGED_WEAPON);
|
public static final Type BOW = new Type("BOW", ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type CROSSBOW = new Type("CROSSBOW", true, ModifierSource.RANGED_WEAPON);
|
public static final Type CROSSBOW = new Type("CROSSBOW", ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type MUSKET = new Type("MUSKET", true, ModifierSource.RANGED_WEAPON);
|
public static final Type MUSKET = new Type("MUSKET", ModifierSource.RANGED_WEAPON);
|
||||||
public static final Type LUTE = new Type("LUTE", true, ModifierSource.RANGED_WEAPON);
|
public static final Type LUTE = new Type("LUTE", ModifierSource.RANGED_WEAPON);
|
||||||
|
|
||||||
|
// Other weapons
|
||||||
|
public static final Type TOOL = new Type("TOOL", ModifierSource.MELEE_WEAPON);
|
||||||
|
|
||||||
// Hand Accessories
|
// Hand Accessories
|
||||||
public static final Type CATALYST = new Type("CATALYST", false, ModifierSource.HAND_ITEM);
|
public static final Type CATALYST = new Type("CATALYST", ModifierSource.HAND_ITEM);
|
||||||
public static final Type OFF_CATALYST = new Type("OFF_CATALYST", false, ModifierSource.OFFHAND_ITEM);
|
public static final Type OFF_CATALYST = new Type("OFF_CATALYST", ModifierSource.OFFHAND_ITEM);
|
||||||
public static final Type MAIN_CATALYST = new Type("MAIN_CATALYST", false, ModifierSource.MAINHAND_ITEM);
|
public static final Type MAIN_CATALYST = new Type("MAIN_CATALYST", ModifierSource.MAINHAND_ITEM);
|
||||||
|
|
||||||
// Any
|
// Other
|
||||||
public static final Type ORNAMENT = new Type("ORNAMENT", false, ModifierSource.VOID);
|
public static final Type ORNAMENT = new Type("ORNAMENT", ModifierSource.VOID);
|
||||||
|
public static final Type ARMOR = new Type("ARMOR", ModifierSource.ARMOR);
|
||||||
// Extra
|
public static final Type CONSUMABLE = new Type("CONSUMABLE", ModifierSource.MAINHAND_ITEM);
|
||||||
public static final Type ARMOR = new Type("ARMOR", false, ModifierSource.ARMOR);
|
public static final Type MISCELLANEOUS = new Type("MISCELLANEOUS", ModifierSource.MAINHAND_ITEM);
|
||||||
public static final Type TOOL = new Type("TOOL", false, ModifierSource.MELEE_WEAPON);
|
public static final Type GEM_STONE = new Type("GEM_STONE", ModifierSource.VOID);
|
||||||
public static final Type CONSUMABLE = new Type("CONSUMABLE", false, ModifierSource.MAINHAND_ITEM);
|
public static final Type SKIN = new Type("SKIN", ModifierSource.VOID);
|
||||||
public static final Type MISCELLANEOUS = new Type("MISCELLANEOUS", false, ModifierSource.MAINHAND_ITEM);
|
public static final Type ACCESSORY = new Type("ACCESSORY", ModifierSource.ACCESSORY);
|
||||||
public static final Type GEM_STONE = new Type("GEM_STONE", false, ModifierSource.VOID);
|
public static final Type BLOCK = new Type("BLOCK", ModifierSource.VOID);
|
||||||
public static final Type SKIN = new Type("SKIN", false, ModifierSource.VOID);
|
|
||||||
public static final Type ACCESSORY = new Type("ACCESSORY", false, ModifierSource.ACCESSORY);
|
|
||||||
public static final Type BLOCK = new Type("BLOCK", false, ModifierSource.VOID);
|
|
||||||
|
|
||||||
private final String id;
|
private final String id;
|
||||||
private final ModifierSource modifierSource;
|
private final ModifierSource modifierSource;
|
||||||
private final boolean weapon;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ -94,7 +93,7 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
|
|
||||||
private UnidentifiedItem unidentifiedTemplate;
|
private UnidentifiedItem unidentifiedTemplate;
|
||||||
|
|
||||||
private SkillHandler onLeftClick, onRightClick, onAttack, onEntityInteract;
|
private SkillHandler<?> onLeftClick, onRightClick, onAttack, onEntityInteract;
|
||||||
|
|
||||||
public Script ent;
|
public Script ent;
|
||||||
|
|
||||||
@ -114,21 +113,28 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hard-coded type with given parameters
|
* @deprecated 'weapon' boolean is now automatically inferred from the modifierSource
|
||||||
*/
|
*/
|
||||||
public Type(String id, boolean weapon, ModifierSource modSource) {
|
@Deprecated
|
||||||
this.id = UtilityMethods.enumName(id);
|
public Type(@NotNull String id, boolean weapon, @NotNull ModifierSource modSource) {
|
||||||
this.modifierSource = modSource;
|
this(id, modSource);
|
||||||
this.weapon = weapon;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom type
|
* Hard-coded type with given parameters. Can be used by other plugins
|
||||||
|
* to create types using MMOItems API.
|
||||||
|
*/
|
||||||
|
public Type(@NotNull String id, @NotNull ModifierSource modifierSource) {
|
||||||
|
this.id = UtilityMethods.enumName(id);
|
||||||
|
this.modifierSource = modifierSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load custom type from a configuration file
|
||||||
*/
|
*/
|
||||||
public Type(@NotNull TypeManager manager, @NotNull ConfigurationSection config) {
|
public Type(@NotNull TypeManager manager, @NotNull ConfigurationSection config) {
|
||||||
id = UtilityMethods.enumName(config.getName());
|
id = UtilityMethods.enumName(config.getName());
|
||||||
parent = manager.get(config.getString("parent", "").toUpperCase().replace("-", "_").replace(" ", "_"));
|
parent = manager.get(config.getString("parent", "").toUpperCase().replace("-", "_").replace(" ", "_"));
|
||||||
weapon = config.getBoolean("weapon", parent != null && parent.weapon);
|
|
||||||
modifierSource = config.contains("modifier-source") ? ModifierSource.valueOf(UtilityMethods.enumName(config.getString("modifier-source"))) : (parent != null ? parent.modifierSource : ModifierSource.OTHER);
|
modifierSource = config.contains("modifier-source") ? ModifierSource.valueOf(UtilityMethods.enumName(config.getString("modifier-source"))) : (parent != null ? parent.modifierSource : ModifierSource.OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +180,7 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWeapon() {
|
public boolean isWeapon() {
|
||||||
return weapon;
|
return modifierSource.isWeapon();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMeleeAttacks() {
|
public boolean hasMeleeAttacks() {
|
||||||
@ -195,7 +201,7 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public SkillHandler onLeftClick() {
|
public SkillHandler<?> onLeftClick() {
|
||||||
return onLeftClick;
|
return onLeftClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,17 +211,17 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public SkillHandler onRightClick() {
|
public SkillHandler<?> onRightClick() {
|
||||||
return onRightClick;
|
return onRightClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public SkillHandler onAttack() {
|
public SkillHandler<?> onAttack() {
|
||||||
return onAttack;
|
return onAttack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public SkillHandler onEntityInteract() {
|
public SkillHandler<?> onEntityInteract() {
|
||||||
return onEntityInteract;
|
return onEntityInteract;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,6 +259,7 @@ public class Type implements CooldownObject, PreloadedObject {
|
|||||||
/**
|
/**
|
||||||
* @return The highest parent of this type, or itself, if it has no parent.
|
* @return The highest parent of this type, or itself, if it has no parent.
|
||||||
*/
|
*/
|
||||||
|
@NotNull
|
||||||
public Type getSupertype() {
|
public Type getSupertype() {
|
||||||
Type parentMost = this;
|
Type parentMost = this;
|
||||||
while (parentMost.parent != null)
|
while (parentMost.parent != null)
|
||||||
|
@ -29,7 +29,7 @@ public class CrazyEnchantsStat extends ItemStat<RandomStatData<CrazyEnchantsData
|
|||||||
* are loaded and added back to the item when building it again.
|
* are loaded and added back to the item when building it again.
|
||||||
*/
|
*/
|
||||||
public CrazyEnchantsStat() {
|
public CrazyEnchantsStat() {
|
||||||
super("CRAZY_ENCHANTS", Material.BOOK, "Advanced Enchants", new String[0], new String[]{"all"});
|
super("CRAZY_ENCHANTS", Material.BOOK, "Advanced Enchants", new String[0], new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
package net.Indyuce.mmoitems.comp.enchants;
|
package net.Indyuce.mmoitems.comp.enchants;
|
||||||
|
|
||||||
import net.Indyuce.mmoitems.stat.type.DisableStat;
|
import net.Indyuce.mmoitems.stat.type.DisableStat;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|
||||||
public class DisableAdvancedEnchantments extends DisableStat {
|
public class DisableAdvancedEnchantments extends DisableStat {
|
||||||
public DisableAdvancedEnchantments() {
|
public DisableAdvancedEnchantments() {
|
||||||
|
|
||||||
super("ADVANCED_ENCHANTS", Material.ENCHANTED_BOOK, "Disable Advanced Enchants", new String[]{"all"}, "When toggled on, prevents players", "from applying AE onto this item.");
|
super("ADVANCED_ENCHANTS", Material.ENCHANTED_BOOK, "Disable Advanced Enchants", new String[0], "When toggled on, prevents players", "from applying AE onto this item.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class BrowserDisplayIDX extends DoubleStat {
|
public class BrowserDisplayIDX extends DoubleStat {
|
||||||
public BrowserDisplayIDX() {
|
public BrowserDisplayIDX() {
|
||||||
super("BROWSER_IDX", Material.GHAST_TEAR, "Browser Index", new String[] {"Used to display similar items together,", "neatly in the GUI \u00a7a/mmoitems browse", "", "Items with the same index are grouped."}, new String[]{"all"});
|
super("BROWSER_IDX", Material.GHAST_TEAR, "Browser Index", new String[] {"Used to display similar items together,", "neatly in the GUI \u00a7a/mmoitems browse", "", "Items with the same index are grouped."}, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public class Crafting extends ItemStat<RandomStatData<StatData>, StatData> {
|
public class Crafting extends ItemStat<RandomStatData<StatData>, StatData> {
|
||||||
public Crafting() {
|
public Crafting() {
|
||||||
super("CRAFTING", VersionMaterial.CRAFTING_TABLE.toMaterial(), "Crafting",
|
super("CRAFTING", VersionMaterial.CRAFTING_TABLE.toMaterial(), "Crafting",
|
||||||
new String[] { "The crafting recipes of your item.", "Changing a recipe requires &o/mi reload recipes&7." }, new String[] { "all" });
|
new String[] { "The crafting recipes of your item.", "Changing a recipe requires &o/mi reload recipes&7." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,6 +9,6 @@ public class CraftingPermission extends StringStat implements TemplateOption, Ge
|
|||||||
public CraftingPermission() {
|
public CraftingPermission() {
|
||||||
super("CRAFT_PERMISSION", VersionMaterial.OAK_SIGN.toMaterial(), "Crafting Recipe Permission",
|
super("CRAFT_PERMISSION", VersionMaterial.OAK_SIGN.toMaterial(), "Crafting Recipe Permission",
|
||||||
new String[]{"The permission needed to craft this item.", "Changing this value requires &o/mi reload recipes&7."},
|
new String[]{"The permission needed to craft this item.", "Changing this value requires &o/mi reload recipes&7."},
|
||||||
new String[]{"all"});
|
new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,7 +36,7 @@ import java.util.Optional;
|
|||||||
public class CustomSounds extends ItemStat<SoundListData, SoundListData> implements GemStoneStat, PlayerConsumable {
|
public class CustomSounds extends ItemStat<SoundListData, SoundListData> implements GemStoneStat, PlayerConsumable {
|
||||||
public CustomSounds() {
|
public CustomSounds() {
|
||||||
super("SOUNDS", Material.JUKEBOX, "Custom Sounds", new String[]{"The custom sounds your item will use."},
|
super("SOUNDS", Material.JUKEBOX, "Custom Sounds", new String[]{"The custom sounds your item will use."},
|
||||||
new String[]{"all"});
|
new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,6 @@ import org.bukkit.Material;
|
|||||||
public class DisableDeathDrop extends BooleanStat {
|
public class DisableDeathDrop extends BooleanStat {
|
||||||
public DisableDeathDrop() {
|
public DisableDeathDrop() {
|
||||||
super("DISABLE_DEATH_DROP", Material.BONE, "Disable Drop On Death",
|
super("DISABLE_DEATH_DROP", Material.BONE, "Disable Drop On Death",
|
||||||
new String[] { "Enable this to prevent this item", "from dropping on the wielder's death." }, new String[] { "all" });
|
new String[] { "Enable this to prevent this item", "from dropping on the wielder's death." }, new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public class DisplayName extends StringStat implements GemStoneStat {
|
|||||||
|
|
||||||
public DisplayName() {
|
public DisplayName() {
|
||||||
super("NAME", VersionMaterial.OAK_SIGN.toMaterial(), "Display Name", new String[]{"The item display name."},
|
super("NAME", VersionMaterial.OAK_SIGN.toMaterial(), "Display Name", new String[]{"The item display name."},
|
||||||
new String[]{"all"});
|
new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,6 @@ import net.Indyuce.mmoitems.stat.type.StringStat;
|
|||||||
|
|
||||||
public class DisplayedType extends StringStat implements GemStoneStat {
|
public class DisplayedType extends StringStat implements GemStoneStat {
|
||||||
public DisplayedType() {
|
public DisplayedType() {
|
||||||
super("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toMaterial(), "Displayed Type", new String[]{"This option will only affect the", "type displayed on the item lore."}, new String[]{"all"});
|
super("DISPLAYED_TYPE", VersionMaterial.OAK_SIGN.toMaterial(), "Displayed Type", new String[]{"This option will only affect the", "type displayed on the item lore."}, new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
public class DyeColor extends ItemStat<ColorData, ColorData> {
|
public class DyeColor extends ItemStat<ColorData, ColorData> {
|
||||||
public DyeColor() {
|
public DyeColor() {
|
||||||
super("DYE_COLOR", VersionMaterial.RED_DYE.toMaterial(), "Dye Color",
|
super("DYE_COLOR", VersionMaterial.RED_DYE.toMaterial(), "Dye Color",
|
||||||
new String[] { "The color of your item", "(for dyeable items).", "In RGB." }, new String[] { "all" }, Material.LEATHER_HELMET,
|
new String[] { "The color of your item", "(for dyeable items).", "In RGB." }, new String[0], Material.LEATHER_HELMET,
|
||||||
Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, VersionMaterial.LEATHER_HORSE_ARMOR.toMaterial());
|
Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, VersionMaterial.LEATHER_HORSE_ARMOR.toMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ import java.util.*;
|
|||||||
public class Elements extends ItemStat<RandomElementListData, ElementListData> implements Previewable<RandomElementListData, ElementListData> {
|
public class Elements extends ItemStat<RandomElementListData, ElementListData> implements Previewable<RandomElementListData, ElementListData> {
|
||||||
public Elements() {
|
public Elements() {
|
||||||
super("ELEMENT", Material.SLIME_BALL, "Elements", new String[]{"The elements of your item."},
|
super("ELEMENT", Material.SLIME_BALL, "Elements", new String[]{"The elements of your item."},
|
||||||
new String[]{"weapon", "catalyst", "tool", "armor", "gem_stone"});
|
new String[]{"equipment", "ornament", "gem_stone"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,7 +43,7 @@ import java.util.*;
|
|||||||
|
|
||||||
public class Enchants extends ItemStat<RandomEnchantListData, EnchantListData> implements Upgradable {
|
public class Enchants extends ItemStat<RandomEnchantListData, EnchantListData> implements Upgradable {
|
||||||
public Enchants() {
|
public Enchants() {
|
||||||
super("ENCHANTS", Material.ENCHANTED_BOOK, "Enchantments", new String[]{"The item enchants."}, new String[]{"all"});
|
super("ENCHANTS", Material.ENCHANTED_BOOK, "Enchantments", new String[]{"The item enchants."}, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +33,7 @@ import java.util.Optional;
|
|||||||
public class GemSockets extends ItemStat<GemSocketsData, GemSocketsData> {
|
public class GemSockets extends ItemStat<GemSocketsData, GemSocketsData> {
|
||||||
public GemSockets() {
|
public GemSockets() {
|
||||||
super("GEM_SOCKETS", Material.EMERALD, "Gem Sockets", new String[]{"The amount of gem", "sockets your weapon has."},
|
super("GEM_SOCKETS", Material.EMERALD, "Gem Sockets", new String[]{"The amount of gem", "sockets your weapon has."},
|
||||||
new String[]{"weapon", "tool", "armor", "accessory", "catalyst", "off_catalyst", "main_catalyst", "ornament", "!gem_stone"});
|
new String[]{"!gem_stone", "equipment", "ornament"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class GrantedPermissions extends StringListStat implements GemStoneStat {
|
public class GrantedPermissions extends StringListStat implements GemStoneStat {
|
||||||
public GrantedPermissions() {
|
public GrantedPermissions() {
|
||||||
super("GRANTED_PERMISSIONS", Material.NAME_TAG, "Granted Permissions",
|
super("GRANTED_PERMISSIONS", Material.NAME_TAG, "Granted Permissions",
|
||||||
new String[] { "A list of permissions that will,", "be granted by the item." }, new String[] { "all" });
|
new String[] { "A list of permissions that will,", "be granted by the item." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import java.util.ArrayList;
|
|||||||
@VersionDependant(minor = 16, patch = 3)
|
@VersionDependant(minor = 16, patch = 3)
|
||||||
public class HideDye extends BooleanStat {
|
public class HideDye extends BooleanStat {
|
||||||
public HideDye() {
|
public HideDye() {
|
||||||
super("HIDE_DYE", Material.CYAN_DYE, "Hide Dyed", new String[] { "Enable to hide the 'Dyed' tag from the item." }, new String[] { "all" },
|
super("HIDE_DYE", Material.CYAN_DYE, "Hide Dyed", new String[] { "Enable to hide the 'Dyed' tag from the item." }, new String[0],
|
||||||
Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, VersionMaterial.LEATHER_HORSE_ARMOR.toMaterial());
|
Material.LEATHER_HELMET, Material.LEATHER_CHESTPLATE, Material.LEATHER_LEGGINGS, Material.LEATHER_BOOTS, VersionMaterial.LEATHER_HORSE_ARMOR.toMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import java.util.ArrayList;
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public class HideEnchants extends BooleanStat {
|
public class HideEnchants extends BooleanStat {
|
||||||
public HideEnchants() {
|
public HideEnchants() {
|
||||||
super("HIDE_ENCHANTS", Material.BOOK, "Hide Enchantments", new String[] { "Enable to completely hide your item", "enchants. You can still see the glowing effect." }, new String[] { "all" });
|
super("HIDE_ENCHANTS", Material.BOOK, "Hide Enchantments", new String[] { "Enable to completely hide your item", "enchants. You can still see the glowing effect." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -20,7 +20,7 @@ import java.util.ArrayList;
|
|||||||
@Deprecated
|
@Deprecated
|
||||||
public class HidePotionEffects extends BooleanStat {
|
public class HidePotionEffects extends BooleanStat {
|
||||||
public HidePotionEffects() {
|
public HidePotionEffects() {
|
||||||
super("HIDE_POTION_EFFECTS", Material.POTION, "Hide Potion Effects", new String[] { "Hides potion effects & 'No Effects'", "from your item lore." }, new String[] { "all" }, Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.TIPPED_ARROW);
|
super("HIDE_POTION_EFFECTS", Material.POTION, "Hide Potion Effects", new String[] { "Hides potion effects & 'No Effects'", "from your item lore." }, new String[0], Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION, Material.TIPPED_ARROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public class ItemLevel extends ItemStat<NumericStatFormula, DoubleData> implements InternalStat {
|
public class ItemLevel extends ItemStat<NumericStatFormula, DoubleData> implements InternalStat {
|
||||||
public ItemLevel() {
|
public ItemLevel() {
|
||||||
super("ITEM_LEVEL", VersionMaterial.EXPERIENCE_BOTTLE.toMaterial(), "Item Level", new String[] { "The item level" }, new String[] { "all" });
|
super("ITEM_LEVEL", VersionMaterial.EXPERIENCE_BOTTLE.toMaterial(), "Item Level", new String[] { "The item level" }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class ItemTierStat extends StringStat implements GemStoneStat {
|
public class ItemTierStat extends StringStat implements GemStoneStat {
|
||||||
public ItemTierStat() {
|
public ItemTierStat() {
|
||||||
super("TIER", Material.DIAMOND, "Item Tier", new String[] { "The tier defines how rare your item is", "and what item is dropped when your",
|
super("TIER", Material.DIAMOND, "Item Tier", new String[] { "The tier defines how rare your item is", "and what item is dropped when your",
|
||||||
"item is deconstructed.", "&9Tiers can be configured in the tiers.yml file" }, new String[] { "all" });
|
"item is deconstructed.", "&9Tiers can be configured in the tiers.yml file" }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,7 +23,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public class Lore extends StringListStat implements GemStoneStat {
|
public class Lore extends StringListStat implements GemStoneStat {
|
||||||
public Lore() {
|
public Lore() {
|
||||||
super("LORE", VersionMaterial.WRITABLE_BOOK.toMaterial(), "Lore", new String[]{"The item lore."}, new String[]{"all"});
|
super("LORE", VersionMaterial.WRITABLE_BOOK.toMaterial(), "Lore", new String[]{"The item lore."}, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,7 +18,7 @@ public class LoreFormat extends StringStat implements GemStoneStat {
|
|||||||
public LoreFormat() {
|
public LoreFormat() {
|
||||||
super("LORE_FORMAT", Material.MAP, "Lore Format", new String[] { "The lore format decides",
|
super("LORE_FORMAT", Material.MAP, "Lore Format", new String[] { "The lore format decides",
|
||||||
"where each stat goes.", "&9Formats can be configured in", "&9the lore-formats folder" },
|
"where each stat goes.", "&9Formats can be configured in", "&9the lore-formats folder" },
|
||||||
new String[] { "all" });
|
new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -29,7 +29,7 @@ import java.util.Optional;
|
|||||||
|
|
||||||
public class MaterialStat extends ItemStat<MaterialData, MaterialData> {
|
public class MaterialStat extends ItemStat<MaterialData, MaterialData> {
|
||||||
public MaterialStat() {
|
public MaterialStat() {
|
||||||
super("MATERIAL", VersionMaterial.GRASS_BLOCK.toMaterial(), "Material", new String[] { "Your item material." }, new String[] { "all" });
|
super("MATERIAL", VersionMaterial.GRASS_BLOCK.toMaterial(), "Material", new String[] { "Your item material." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class NBTTags extends StringListStat {
|
public class NBTTags extends StringListStat {
|
||||||
public NBTTags() {
|
public NBTTags() {
|
||||||
super("CUSTOM_NBT", Material.NAME_TAG, "NBT Tags", new String[] { "Custom NBT Tags." }, new String[] { "all" });
|
super("CUSTOM_NBT", Material.NAME_TAG, "NBT Tags", new String[] { "Custom NBT Tags." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Optional;
|
|||||||
public class PotionColor extends ItemStat<ColorData, ColorData> {
|
public class PotionColor extends ItemStat<ColorData, ColorData> {
|
||||||
public PotionColor() {
|
public PotionColor() {
|
||||||
super("POTION_COLOR", Material.POTION, "Potion Color",
|
super("POTION_COLOR", Material.POTION, "Potion Color",
|
||||||
new String[] { "The color of your potion.", "(Doesn't impact the effects)." }, new String[] { "all" }, Material.POTION,
|
new String[] { "The color of your potion.", "(Doesn't impact the effects)." }, new String[0], Material.POTION,
|
||||||
Material.SPLASH_POTION, Material.LINGERING_POTION, Material.TIPPED_ARROW);
|
Material.SPLASH_POTION, Material.LINGERING_POTION, Material.TIPPED_ARROW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import java.util.Set;
|
|||||||
public class PotionEffects extends ItemStat<RandomPotionEffectListData, PotionEffectListData> {
|
public class PotionEffects extends ItemStat<RandomPotionEffectListData, PotionEffectListData> {
|
||||||
public PotionEffects() {
|
public PotionEffects() {
|
||||||
super("POTION_EFFECT", Material.POTION, "Potion Effects", new String[] { "The effects of your potion.", "(May have an impact on color).", "Does NOT support tipped arrows." },
|
super("POTION_EFFECT", Material.POTION, "Potion Effects", new String[] { "The effects of your potion.", "(May have an impact on color).", "Does NOT support tipped arrows." },
|
||||||
new String[] { "all" }, Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION);
|
new String[0], Material.POTION, Material.SPLASH_POTION, Material.LINGERING_POTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -6,6 +6,6 @@ import org.bukkit.Material;
|
|||||||
|
|
||||||
public class RepairReference extends StringStat implements GemStoneStat {
|
public class RepairReference extends StringStat implements GemStoneStat {
|
||||||
public RepairReference() {
|
public RepairReference() {
|
||||||
super("REPAIR_TYPE", Material.ANVIL, "Repair Reference", new String[]{"A repair consumable may only be used onto", "an item with the same repair reference."}, new String[]{"all"});
|
super("REPAIR_TYPE", Material.ANVIL, "Repair Reference", new String[]{"A repair consumable may only be used onto", "an item with the same repair reference."}, new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public class RevisionID extends ItemStat<NumericStatFormula, DoubleData> impleme
|
|||||||
public RevisionID() {
|
public RevisionID() {
|
||||||
super("REVISION_ID", Material.ITEM_FRAME, "Revision ID", new String[] { "The Revision ID is used to determine",
|
super("REVISION_ID", Material.ITEM_FRAME, "Revision ID", new String[] { "The Revision ID is used to determine",
|
||||||
"if an item is outdated or not. You", "should increase this whenever", "you make changes to your item!", "", "\u00a76The updater is smart and will apply", "\u00a76changes to the base stats of the item,", "\u00a76keeping gemstones intact (for example)."},
|
"if an item is outdated or not. You", "should increase this whenever", "you make changes to your item!", "", "\u00a76The updater is smart and will apply", "\u00a76changes to the base stats of the item,", "\u00a76keeping gemstones intact (for example)."},
|
||||||
new String[] { "all" });
|
new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -34,7 +34,7 @@ import java.util.Set;
|
|||||||
public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPatternData> {
|
public class ShieldPatternStat extends ItemStat<ShieldPatternData, ShieldPatternData> {
|
||||||
public ShieldPatternStat() {
|
public ShieldPatternStat() {
|
||||||
super("SHIELD_PATTERN", Material.SHIELD, "Shield Pattern", new String[] { "The color & patterns", "of your shield." },
|
super("SHIELD_PATTERN", Material.SHIELD, "Shield Pattern", new String[] { "The color & patterns", "of your shield." },
|
||||||
new String[] { "all" }, Material.SHIELD);
|
new String[0], Material.SHIELD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +33,7 @@ public class SkullTextureStat extends ItemStat<SkullTextureData, SkullTextureDat
|
|||||||
"The skull texture &nvalue&7 which can be found on",
|
"The skull texture &nvalue&7 which can be found on",
|
||||||
"head databases. 1.20+ users can also provide the",
|
"head databases. 1.20+ users can also provide the",
|
||||||
"texture URL directly (starting with https://...)."
|
"texture URL directly (starting with https://...)."
|
||||||
}, new String[]{"all"}, VersionMaterial.PLAYER_HEAD.toMaterial());
|
}, new String[0], VersionMaterial.PLAYER_HEAD.toMaterial());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,7 +37,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
public class Soulbound extends ItemStat<RandomStatData<SoulboundData>, SoulboundData> implements InternalStat, ItemRestriction {
|
public class Soulbound extends ItemStat<RandomStatData<SoulboundData>, SoulboundData> implements InternalStat, ItemRestriction {
|
||||||
public Soulbound() {
|
public Soulbound() {
|
||||||
super("SOULBOUND", VersionMaterial.ENDER_EYE.toMaterial(), "Soulbound", new String[0], new String[] { "all" });
|
super("SOULBOUND", VersionMaterial.ENDER_EYE.toMaterial(), "Soulbound", new String[0], new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -28,7 +28,7 @@ import java.util.Optional;
|
|||||||
public class StoredTags extends ItemStat<RandomStatData<StoredTagsData>, StoredTagsData> implements InternalStat, GemStoneStat {
|
public class StoredTags extends ItemStat<RandomStatData<StoredTagsData>, StoredTagsData> implements InternalStat, GemStoneStat {
|
||||||
public StoredTags() {
|
public StoredTags() {
|
||||||
super("STORED_TAGS", VersionMaterial.OAK_SIGN.toMaterial(), "Stored Tags",
|
super("STORED_TAGS", VersionMaterial.OAK_SIGN.toMaterial(), "Stored Tags",
|
||||||
new String[] { "You found a secret dev easter egg", "introduced during the 2020 epidemic!" }, new String[] { "all" });
|
new String[] { "You found a secret dev easter egg", "introduced during the 2020 epidemic!" }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -16,7 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class TooltipStat extends StringStat implements GemStoneStat {
|
public class TooltipStat extends StringStat implements GemStoneStat {
|
||||||
public TooltipStat() {
|
public TooltipStat() {
|
||||||
super("TOOLTIP", Material.BIRCH_SIGN, "Tooltip", new String[]{"The identifier of the custom tooltip texture", "you'd like to use. Check the wiki for usage!",
|
super("TOOLTIP", Material.BIRCH_SIGN, "Tooltip", new String[]{"The identifier of the custom tooltip texture", "you'd like to use. Check the wiki for usage!",
|
||||||
"&9Tooltips are setup in the tooltips.yml file"}, new String[]{"all"});
|
"&9Tooltips are setup in the tooltips.yml file"}, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,7 +16,7 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class Unbreakable extends BooleanStat {
|
public class Unbreakable extends BooleanStat {
|
||||||
public Unbreakable() {
|
public Unbreakable() {
|
||||||
super("UNBREAKABLE", Material.ANVIL, "Unbreakable", new String[] { "Infinite durability if set to true." }, new String[] { "all" });
|
super("UNBREAKABLE", Material.ANVIL, "Unbreakable", new String[] { "Infinite durability if set to true." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
public class Unstackable extends BooleanStat {
|
public class Unstackable extends BooleanStat {
|
||||||
public Unstackable() {
|
public Unstackable() {
|
||||||
super("UNSTACKABLE", Material.CHEST_MINECART, "Unstackable",
|
super("UNSTACKABLE", Material.CHEST_MINECART, "Unstackable",
|
||||||
new String[] { "This will make the item unable", "to be stacked with itself." }, new String[] { "all" });
|
new String[] { "This will make the item unable", "to be stacked with itself." }, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,14 +43,14 @@ import java.util.Optional;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements ConsumableItemInteraction {
|
public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements ConsumableItemInteraction {
|
||||||
private static final Random random = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
|
|
||||||
public UpgradeStat() {
|
public UpgradeStat() {
|
||||||
super("UPGRADE", Material.FLINT, "Item Upgrading",
|
super("UPGRADE", Material.FLINT, "Item Upgrading",
|
||||||
new String[] { "Upgrading your item improves its", "current stats. It requires either a", "consumable or a specific crafting ",
|
new String[]{"Upgrading your item improves its", "current stats. It requires either a", "consumable or a specific crafting ",
|
||||||
"station. Upgrading may sometimes &cfail&7..." },
|
"station. Upgrading may sometimes &cfail&7..."},
|
||||||
new String[] { "weapon", "catalyst", "tool", "armor", "consumable", "accessory" });
|
new String[]{"equipment"});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UpgradeData whenInitialized(Object object) {
|
public UpgradeData whenInitialized(Object object) {
|
||||||
@ -234,7 +234,7 @@ public class UpgradeStat extends ItemStat<UpgradeData, UpgradeData> implements C
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (random.nextDouble() > consumableSharpening.getSuccess() * targetSharpening.getSuccess()) {
|
if (RANDOM.nextDouble() > consumableSharpening.getSuccess() * targetSharpening.getSuccess()) {
|
||||||
Message.UPGRADE_FAIL.format(ChatColor.RED).send(player);
|
Message.UPGRADE_FAIL.format(ChatColor.RED).send(player);
|
||||||
if (targetSharpening.destroysOnFail())
|
if (targetSharpening.destroysOnFail())
|
||||||
event.getCurrentItem().setAmount(0);
|
event.getCurrentItem().setAmount(0);
|
||||||
|
@ -10,11 +10,11 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class DisableStat extends BooleanStat {
|
public class DisableStat extends BooleanStat {
|
||||||
public DisableStat(String id, Material material, String name, String... lore) {
|
public DisableStat(String id, Material material, String name, String... lore) {
|
||||||
super("DISABLE_" + id, material, name, lore, new String[] { "all" });
|
super("DISABLE_" + id, material, name, lore, new String[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisableStat(String id, Material material, String name, Material[] materials, String... lore) {
|
public DisableStat(String id, Material material, String name, Material[] materials, String... lore) {
|
||||||
super("DISABLE_" + id, material, name, lore, new String[] { "all" }, materials);
|
super("DISABLE_" + id, material, name, lore, new String[0], materials);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisableStat(String id, Material material, String name, String[] types, String... lore) {
|
public DisableStat(String id, Material material, String name, String[] types, String... lore) {
|
||||||
|
@ -44,17 +44,13 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
|||||||
*
|
*
|
||||||
* @param id The item stat ID, used internally. Also determines the
|
* @param id The item stat ID, used internally. Also determines the
|
||||||
* lower case path for config files
|
* lower case path for config files
|
||||||
* @param material The material used to display the stat in the item
|
* @param material The material used to display the stat in the item edition GUI
|
||||||
* edition GUI
|
* @param name The stat name which has a translation in the language files
|
||||||
* @param name The stat name which has a translation in the language
|
|
||||||
* files
|
|
||||||
* @param lore The stat description used in the edition GUI
|
* @param lore The stat description used in the edition GUI
|
||||||
* @param types Compatible types. Use 'all' to support all item types or
|
* @param types Compatible types. See {@link #isCompatible(Type)}
|
||||||
* !{type-name} to blacklist an item type
|
* @param materials Materials compatible with the item stat (e.g Shield Pattern), any if empty
|
||||||
* @param materials Materials compatible with the item stat (eg Shield
|
|
||||||
* Pattern), any if empty
|
|
||||||
*/
|
*/
|
||||||
public ItemStat(@NotNull String id, @NotNull Material material, @NotNull String name, String[] lore, String[] types, Material... materials) {
|
public ItemStat(@NotNull String id, @NotNull Material material, @NotNull String name, @Nullable String[] lore, @Nullable String[] types, Material... materials) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.material = material;
|
this.material = material;
|
||||||
this.lore = lore == null ? new String[0] : lore;
|
this.lore = lore == null ? new String[0] : lore;
|
||||||
@ -268,19 +264,20 @@ public abstract class ItemStat<R extends RandomStatData<S>, S extends StatData>
|
|||||||
*/
|
*/
|
||||||
public boolean isCompatible(@NotNull Type type) {
|
public boolean isCompatible(@NotNull Type type) {
|
||||||
|
|
||||||
// Special rule for weapons
|
if (compatibleTypes.isEmpty()) return true;
|
||||||
if (type.isWeapon() && compatibleTypes.contains("weapon")) return true;
|
|
||||||
|
|
||||||
// Recursive call with root types
|
// Main rules
|
||||||
if (type.isSubtype()) return isCompatible(type.getParent());
|
if (type.getModifierSource().isWeapon() && compatibleTypes.contains("weapon")) return true;
|
||||||
|
if (type.getModifierSource().isEquipment() && compatibleTypes.contains("equipment")) return true;
|
||||||
|
if (type.getModifierSource().isHandheld() && compatibleTypes.contains("handheld")) return true;
|
||||||
|
|
||||||
// Parent item types
|
// Supertype/parent/root type
|
||||||
final String lower = type.getId().toLowerCase();
|
final String lower = type.getSupertype().getId().toLowerCase();
|
||||||
return !compatibleTypes.contains("!" + lower) && (compatibleTypes.contains("all") || compatibleTypes.contains(lower));
|
return !compatibleTypes.contains("!" + lower) && (compatibleTypes.contains("all") || compatibleTypes.contains(lower));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasValidMaterial(ItemStack item) {
|
public boolean hasValidMaterial(ItemStack item) {
|
||||||
return compatibleMaterials.size() == 0 || compatibleMaterials.contains(item.getType());
|
return compatibleMaterials.isEmpty() || compatibleMaterials.contains(item.getType());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void disable() {
|
public void disable() {
|
||||||
|
Loading…
Reference in New Issue
Block a user