mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-02 06:27:42 +01:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # .gitignore # MMOItems-API/MMOItems-API.iml # MMOItems-Dist/MMOItems-Dist.iml
This commit is contained in:
commit
c095ecaa91
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,13 +1,19 @@
|
||||
/bin/
|
||||
/target/
|
||||
MMOItems-API/target/
|
||||
MMOItems-Dist/target/
|
||||
/.settings/
|
||||
/.idea/
|
||||
/.m2/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
MMOItems.eml
|
||||
MMOItems.iml
|
||||
MMOItems-API.eml
|
||||
MMOItems-API.iml
|
||||
MMOItems-Dist.eml
|
||||
MMOItems-Dist.iml
|
||||
|
||||
.flattened-pom.xml
|
||||
dependency-reduced-pom.xml
|
||||
|
@ -118,7 +118,6 @@
|
||||
the first wins when multiple classpaths match
|
||||
-->
|
||||
<dependencies>
|
||||
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
@ -126,7 +125,6 @@
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-clean-plugin -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -134,211 +132,209 @@
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- AuthLib -->
|
||||
<dependency>
|
||||
<groupId>com.mojang</groupId>
|
||||
<artifactId>authlib</artifactId>
|
||||
<version>1.5.21</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- MMOCore Api -->
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOCore-API</artifactId>
|
||||
<version>1.9.5-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- MythicEnchants -->
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>MythicEnchants</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- PhatLoots -->
|
||||
<dependency>
|
||||
<groupId>com.github.RednedEpic</groupId>
|
||||
<artifactId>PhatLoots</artifactId>
|
||||
<version>4.2.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- placeholderapi -->
|
||||
<dependency>
|
||||
<groupId>me.clip</groupId>
|
||||
<artifactId>placeholderapi</artifactId>
|
||||
<version>2.9.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Mythic -->
|
||||
<dependency>
|
||||
<groupId>io.lumine</groupId>
|
||||
<artifactId>Mythic-Dist</artifactId>
|
||||
<version>5.1.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- WordGuard -->
|
||||
<dependency>
|
||||
<groupId>com.sk89q.worldguard</groupId>
|
||||
<artifactId>worldguard-bukkit</artifactId>
|
||||
<version>7.0.2-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Vault -->
|
||||
<dependency>
|
||||
<groupId>com.github.MilkBowl</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.7</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Local dependencies -->
|
||||
<!-- SkillAPI -->
|
||||
<dependency>
|
||||
<groupId>com.github.Eniripsa96</groupId>
|
||||
<artifactId>SkillAPI</artifactId>
|
||||
<version>master</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- AE Api -->
|
||||
<dependency>
|
||||
<groupId>n3kas</groupId>
|
||||
<artifactId>ae.api</artifactId>
|
||||
<version>5.7.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- BossShop -->
|
||||
<dependency>
|
||||
<groupId>org.black_ixx</groupId>
|
||||
<artifactId>BossShop</artifactId>
|
||||
<version>2.0.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Residence -->
|
||||
<dependency>
|
||||
<groupId>com.bekvon.bukkit.residence</groupId>
|
||||
<artifactId>Residence</artifactId>
|
||||
<version>4.8.7.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Heroes -->
|
||||
<dependency>
|
||||
<groupId>com.herocraftonline</groupId>
|
||||
<artifactId>Heroes</artifactId>
|
||||
<version>1.9.22</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- mcMMO -->
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.104</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- McRPG -->
|
||||
<dependency>
|
||||
<groupId>us.eunoians</groupId>
|
||||
<artifactId>McRPG</artifactId>
|
||||
<version>1.1.2</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Rpl -->
|
||||
<dependency>
|
||||
<groupId>me.baks</groupId>
|
||||
<artifactId>rpl</artifactId>
|
||||
<version>3.9.30</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Skills -->
|
||||
<dependency>
|
||||
<groupId>me.leothepro555</groupId>
|
||||
<artifactId>skills</artifactId>
|
||||
<version>12.3.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- SkillsPro -->
|
||||
<dependency>
|
||||
<groupId>org.skills.main</groupId>
|
||||
<artifactId>SkillsPro</artifactId>
|
||||
<version>18.9.0.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- BattleLevels -->
|
||||
<dependency>
|
||||
<groupId>me.robin</groupId>
|
||||
<artifactId>BattleLevels</artifactId>
|
||||
<version>6.9.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- TrHologram -->
|
||||
<dependency>
|
||||
<groupId>me.arasple.mc</groupId>
|
||||
<artifactId>TrHologram</artifactId>
|
||||
<version>1.11</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- HolographicDisplays API -->
|
||||
<dependency>
|
||||
<groupId>com.gmail.filoghost.holographicdisplays</groupId>
|
||||
<artifactId>holographicdisplays-api</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- RacesAndClasses -->
|
||||
<dependency>
|
||||
<groupId>de.tobiyas</groupId>
|
||||
<artifactId>RacesAndClasses</artifactId>
|
||||
<version>1.2.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Rpg Inventory -->
|
||||
<dependency>
|
||||
<groupId>ru.endlesscode</groupId>
|
||||
<artifactId>rpginventory</artifactId>
|
||||
<version>2.3.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Holograms -->
|
||||
<dependency>
|
||||
<groupId>com.sainttx.holograms</groupId>
|
||||
<artifactId>Holograms</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Aurelium Skills -->
|
||||
<dependency>
|
||||
<groupId>com.archyx</groupId>
|
||||
<artifactId>AureliumSkills</artifactId>
|
||||
<version>1.2.8</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Crazy Enchantments -->
|
||||
<dependency>
|
||||
<groupId>me.badbones69</groupId>
|
||||
<artifactId>crazyenchantments</artifactId>
|
||||
<version>1.8-db9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Citizens -->
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>Citizens</artifactId>
|
||||
<version>2.0.25</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Denizen -->
|
||||
<dependency>
|
||||
<groupId>com.denizenscript</groupId>
|
||||
<artifactId>denizen</artifactId>
|
||||
<version>1.2.1-b1744-REL</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Denizen -->
|
||||
<dependency>
|
||||
<groupId>com.denizenscript</groupId>
|
||||
<artifactId>depenizen</artifactId>
|
||||
<version>2.0.0-b709</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -70,7 +70,7 @@ public class ItemStats {
|
||||
PARRY_COOLDOWN_REDUCTION = new DoubleStat("PARRY_COOLDOWN_REDUCTION", Material.BUCKET, "Parry Cooldown Reduction", new String[]{"Reduces the parrying cooldown (%)."}, new String[]{"!miscellaneous", "!block", "all"}),
|
||||
COOLDOWN_REDUCTION = new DoubleStat("COOLDOWN_REDUCTION", Material.BOOK, "Cooldown Reduction", new String[]{"Reduces cooldowns of item and player skills (%)."}),
|
||||
RANGE = new DoubleStat("RANGE", Material.STICK, "Range", new String[]{"The range of your item attacks."}, new String[]{"staff", "whip", "wand", "musket"}),
|
||||
MANA_COST = new DoubleStat("MANA_COST", VersionMaterial.LAPIS_LAZULI.toMaterial(), "Mana Cost", new String[]{"Mana spent by your weapon to be used."}, new String[]{"piercing", "slashing", "blunt", "range"}),
|
||||
MANA_COST = new ManaCost(),
|
||||
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[]{"piercing", "slashing", "blunt", "range"}),
|
||||
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(),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@ package net.Indyuce.mmoitems.api;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
|
||||
public enum CustomSound {
|
||||
|
@ -1,10 +1,10 @@
|
||||
package net.Indyuce.mmoitems.api;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.stat.data.ParticleData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -31,50 +31,55 @@ public class ItemSet {
|
||||
this.loreTag = config.getStringList("lore-tag");
|
||||
this.name = config.getString("name");
|
||||
|
||||
Validate.isTrue(config.contains("bonuses"), "Could not find item set bonuses");
|
||||
Validate.isTrue(config.isConfigurationSection("bonuses"), "Could not find item set bonuses");
|
||||
|
||||
for (int j = 2; j <= itemLimit; j++)
|
||||
if (config.getConfigurationSection("bonuses").contains(String.valueOf(j))) {
|
||||
SetBonuses bonuses = new SetBonuses();
|
||||
final String bonusesKey = "bonuses.%d".formatted(j);
|
||||
final SetBonuses bonuses = new SetBonuses();
|
||||
final ConfigurationSection bonusesSection = config.getConfigurationSection(bonusesKey);
|
||||
Validate.notNull(bonusesSection, "Item set '%s' is not a valid configuration section.".formatted(id));
|
||||
|
||||
// Add permissions
|
||||
for (String perm : config.getConfigurationSection("bonuses." + j).getStringList("granted-permissions"))
|
||||
for (String perm : bonusesSection.getStringList("granted-permissions"))
|
||||
bonuses.addPermission(perm);
|
||||
|
||||
for (String key : config.getConfigurationSection("bonuses." + j).getKeys(false))
|
||||
for (String key : bonusesSection.getKeys(false))
|
||||
if (!key.equals("granted-permissions")) {
|
||||
|
||||
try {
|
||||
String format = key.toUpperCase().replace("-", "_").replace(" ", "_");
|
||||
|
||||
// ability
|
||||
if (key.startsWith("ability-")) {
|
||||
bonuses.addAbility(new AbilityData(config.getConfigurationSection("bonuses." + j + "." + key)));
|
||||
final ConfigurationSection section = config.getConfigurationSection("%s.%s".formatted(bonusesKey, key));
|
||||
Validate.notNull(section, "Ability '%s' is not a valid configuration section.".formatted(key));
|
||||
bonuses.addAbility(new AbilityData(section));
|
||||
continue;
|
||||
}
|
||||
|
||||
// potion effect
|
||||
if (key.startsWith("potion-")) {
|
||||
PotionEffectType potionEffectType = PotionEffectType.getByName(format.substring("potion-".length()));
|
||||
Validate.notNull(potionEffectType, "Could not load potion effect type from '" + format + "'");
|
||||
Validate.notNull(potionEffectType, "Could not load potion effect type from '%s'".formatted(format));
|
||||
bonuses.addPotionEffect(new PotionEffect(potionEffectType, MMOUtils.getEffectDuration(potionEffectType),
|
||||
config.getInt("bonuses." + j + "." + key) - 1, true, false));
|
||||
config.getInt("%s.%s".formatted(bonusesKey, key)) - 1, true, false));
|
||||
continue;
|
||||
}
|
||||
|
||||
// particle effect
|
||||
if (key.startsWith("particle-")) {
|
||||
bonuses.addParticle(new ParticleData(config.getConfigurationSection("bonuses." + j + "." + key)));
|
||||
final ConfigurationSection section = config.getConfigurationSection("bonuses.%d.%s".formatted(j, key));
|
||||
Validate.notNull(section, "Particle effect '%s' is not a valid configuration section.".formatted(key));
|
||||
bonuses.addParticle(new ParticleData(section));
|
||||
continue;
|
||||
}
|
||||
|
||||
// stat
|
||||
ItemStat stat = MMOItems.plugin.getStats().get(format);
|
||||
Validate.notNull(stat, "Could not find stat called '" + format + "'");
|
||||
bonuses.addStat(stat, config.getDouble("bonuses." + j + "." + key));
|
||||
|
||||
ItemStat<?, ?> stat = MMOItems.plugin.getStats().get(format);
|
||||
Validate.notNull(stat, "Could not find stat called '%s'".formatted(format));
|
||||
bonuses.addStat(stat, config.getDouble("bonuses.%d.%s".formatted(j, key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
throw new IllegalArgumentException("Could not load set bonus '" + key + "': " + exception.getMessage());
|
||||
throw new IllegalArgumentException("Could not load set bonus '%s': %s".formatted(key, exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,13 +108,13 @@ public class ItemSet {
|
||||
}
|
||||
|
||||
public static class SetBonuses {
|
||||
private final Map<ItemStat, Double> stats = new HashMap<>();
|
||||
private final Map<ItemStat<?, ?>, Double> stats = new HashMap<>();
|
||||
private final Map<PotionEffectType, PotionEffect> permEffects = new HashMap<>();
|
||||
private final Set<AbilityData> abilities = new HashSet<>();
|
||||
private final Set<ParticleData> particles = new HashSet<>();
|
||||
private final ArrayList<String> permissions = new ArrayList<>();
|
||||
|
||||
public void addStat(ItemStat stat, double value) {
|
||||
public void addStat(ItemStat<?, ?> stat, double value) {
|
||||
stats.put(stat, value);
|
||||
}
|
||||
|
||||
@ -129,15 +134,15 @@ public class ItemSet {
|
||||
permissions.add(permission);
|
||||
}
|
||||
|
||||
public boolean hasStat(ItemStat stat) {
|
||||
public boolean hasStat(ItemStat<?, ?> stat) {
|
||||
return stats.containsKey(stat);
|
||||
}
|
||||
|
||||
public double getStat(ItemStat stat) {
|
||||
public double getStat(ItemStat<?, ?> stat) {
|
||||
return stats.get(stat);
|
||||
}
|
||||
|
||||
public Map<ItemStat, Double> getStats() {
|
||||
public Map<ItemStat<?, ?>, Double> getStats() {
|
||||
return stats;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
|
@ -6,7 +6,7 @@ import io.lumine.mythic.lib.api.util.ui.QuickNumberRange;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.MMOItemPlayerIngredient;
|
||||
|
@ -10,8 +10,7 @@ import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackMessage;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.inventory.VanillaPlayerIngredient;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.FFPMMOItems;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.api.crafting.recipe;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.CheckedIngredient;
|
||||
|
@ -8,67 +8,63 @@ import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
|
||||
public class RepairItemEvent extends PlayerDataEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final VolatileMMOItem consumable;
|
||||
private final NBTItem target;
|
||||
private final VolatileMMOItem consumable;
|
||||
private final NBTItem target;
|
||||
|
||||
private int repaired;
|
||||
private double repairedPercent;
|
||||
private int repaired = -1;
|
||||
private double repairedPercent = -1;
|
||||
|
||||
/**
|
||||
* Called when a player repairs an item using a consumable
|
||||
*
|
||||
* @param playerData
|
||||
* Player repairing the item
|
||||
* @param consumable
|
||||
* Consumable used to repair the item
|
||||
* @param target
|
||||
* Item being repaired
|
||||
* @param repaired
|
||||
* Amount of durability being repaired
|
||||
*/
|
||||
public RepairItemEvent(PlayerData playerData, VolatileMMOItem consumable, NBTItem target, int repaired) {
|
||||
super(playerData);
|
||||
/**
|
||||
* Called when a player repairs an item using a consumable
|
||||
*
|
||||
* @param playerData Player repairing the item
|
||||
* @param consumable Consumable used to repair the item
|
||||
* @param target Item being repaired
|
||||
* @param repaired Amount of durability being repaired
|
||||
*/
|
||||
public RepairItemEvent(PlayerData playerData, VolatileMMOItem consumable, NBTItem target, int repaired) {
|
||||
super(playerData);
|
||||
|
||||
this.consumable = consumable;
|
||||
this.target = target;
|
||||
this.repaired = repaired;
|
||||
}
|
||||
this.consumable = consumable;
|
||||
this.target = target;
|
||||
this.repaired = repaired;
|
||||
}
|
||||
|
||||
public RepairItemEvent(PlayerData playerData, VolatileMMOItem consumable, NBTItem target, double repaired) {
|
||||
super(playerData);
|
||||
public RepairItemEvent(PlayerData playerData, VolatileMMOItem consumable, NBTItem target, double repaired) {
|
||||
super(playerData);
|
||||
|
||||
this.consumable = consumable;
|
||||
this.target = target;
|
||||
this.repairedPercent = repaired;
|
||||
}
|
||||
this.consumable = consumable;
|
||||
this.target = target;
|
||||
this.repairedPercent = repaired;
|
||||
}
|
||||
|
||||
public VolatileMMOItem getConsumable() {
|
||||
return consumable;
|
||||
}
|
||||
public VolatileMMOItem getConsumable() {
|
||||
return consumable;
|
||||
}
|
||||
|
||||
public NBTItem getTargetItem() {
|
||||
return target;
|
||||
}
|
||||
public NBTItem getTargetItem() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public int getRepaired() {
|
||||
return repaired;
|
||||
}
|
||||
public int getRepaired() {
|
||||
return repaired;
|
||||
}
|
||||
|
||||
public double getRepairedPercent(){
|
||||
return repairedPercent;
|
||||
}
|
||||
public double getRepairedPercent() {
|
||||
return repairedPercent;
|
||||
}
|
||||
|
||||
public void setRepaired(int repaired) {
|
||||
this.repaired = repaired;
|
||||
}
|
||||
public void setRepaired(int repaired) {
|
||||
this.repaired = repaired;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.api.interaction;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.ApplyGemStoneEvent;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
|
@ -11,7 +11,7 @@ import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.LuteAttackEffectStat.LuteAttackEffect;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
|
@ -5,12 +5,10 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
|
@ -5,12 +5,10 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
|
@ -5,12 +5,10 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
|
@ -5,12 +5,10 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
|
@ -5,12 +5,10 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.util.SoundReader;
|
||||
import net.Indyuce.mmoitems.stat.data.ProjectileParticlesData;
|
||||
import org.bukkit.Location;
|
||||
|
@ -4,11 +4,10 @@ import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
|
@ -4,11 +4,10 @@ import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
@ -4,12 +4,11 @@ import io.lumine.mythic.lib.UtilityMethods;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.comp.target.InteractionType;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
@ -8,7 +8,7 @@ import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import io.lumine.mythic.lib.version.VersionSound;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
|
@ -2,12 +2,11 @@ package net.Indyuce.mmoitems.api.interaction.weapon.untargeted.staff;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.player.EquipmentSlot;
|
||||
import io.lumine.mythic.lib.damage.AttackMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageMetadata;
|
||||
import io.lumine.mythic.lib.damage.DamageType;
|
||||
import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.skill.Shulker_Missile;
|
||||
import net.Indyuce.mmoitems.skill.ShulkerMissile;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.ShulkerBullet;
|
||||
@ -34,6 +33,6 @@ public class VoidSpirit implements StaffAttackHandler {
|
||||
shulkerBullet.setVelocity(vec);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new Shulker_Missile.ShulkerMissileEntityData(caster, new DamageMetadata(damage, DamageType.WEAPON, DamageType.MAGIC, DamageType.PROJECTILE), 0, nbt));
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ShulkerMissile.ShulkerMissileEntityData(caster, new DamageMetadata(damage, DamageType.WEAPON, DamageType.MAGIC, DamageType.PROJECTILE), 0, nbt));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.Indyuce.mmoitems.api.item.template;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmoitems.api.item.util;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.adventure.text.Component;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.LegacyComponent;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.Indyuce.mmoitems.api.crafting.condition.CheckedCondition;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.adventure.text.Component;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.LegacyComponent;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.Indyuce.mmoitems.api.crafting.condition.CheckedCondition;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
||||
|
@ -8,7 +8,6 @@ import io.lumine.mythic.lib.player.PlayerMetadata;
|
||||
import io.lumine.mythic.lib.player.modifier.ModifierSource;
|
||||
import io.lumine.mythic.lib.player.modifier.ModifierType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.player.inventory.EquippedItem;
|
||||
import net.Indyuce.mmoitems.stat.type.AttackWeaponStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
@ -28,11 +27,11 @@ public class PlayerStats {
|
||||
return playerData.getMMOPlayerData().getStatMap();
|
||||
}
|
||||
|
||||
public double getStat(ItemStat stat) {
|
||||
public double getStat(ItemStat<?, ?> stat) {
|
||||
return getMap().getInstance(stat.getId()).getTotal();
|
||||
}
|
||||
|
||||
public StatInstance getInstance(ItemStat stat) {
|
||||
public StatInstance getInstance(ItemStat<?, ?> stat) {
|
||||
return getMap().getInstance(stat.getId());
|
||||
}
|
||||
|
||||
@ -50,8 +49,7 @@ public class PlayerStats {
|
||||
}
|
||||
|
||||
public void updateStats() {
|
||||
|
||||
for (ItemStat stat : MMOItems.plugin.getStats().getNumericStats()) {
|
||||
for (ItemStat<?, ?> stat : MMOItems.plugin.getStats().getNumericStats()) {
|
||||
|
||||
// Let MMOItems first add stat modifiers, and then update the stat instance
|
||||
StatInstance.ModifierPacket packet = getInstance(stat).newPacket();
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.api.recipe;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.manager.RecipeManager;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||
import io.lumine.mythic.lib.command.api.Parameter;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
|
@ -13,8 +13,8 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.ExtraAttribute;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Attribute;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.Required_Profession;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.RequiredAttribute;
|
||||
import net.Indyuce.mmoitems.comp.mmocore.stat.RequiredProfession;
|
||||
import net.Indyuce.mmoitems.comp.rpg.RPGHandler;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -32,7 +32,7 @@ public class MMOCoreHook implements RPGHandler, Listener {
|
||||
*/
|
||||
public MMOCoreHook() {
|
||||
for (PlayerAttribute attribute : MMOCore.plugin.attributeManager.getAll()) {
|
||||
MMOItems.plugin.getStats().register(new Required_Attribute(attribute));
|
||||
MMOItems.plugin.getStats().register(new RequiredAttribute(attribute));
|
||||
MMOItems.plugin.getStats().register(new ExtraAttribute(attribute));
|
||||
}
|
||||
|
||||
@ -43,8 +43,7 @@ public class MMOCoreHook implements RPGHandler, Listener {
|
||||
.replace('-', '_').replace(' ', '_').toUpperCase(Locale.ROOT),
|
||||
VersionMaterial.EXPERIENCE_BOTTLE.toMaterial(), profession.getName() + ' ' + "Additional Experience (MMOCore)"
|
||||
, new String[]{"Additional MMOCore profession " + profession.getName() + " experience in %."}, new String[]{"!block", "all"}));
|
||||
|
||||
MMOItems.plugin.getStats().register(new Required_Profession(profession));
|
||||
MMOItems.plugin.getStats().register(new RequiredProfession(profession));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,11 +12,11 @@ import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class Required_Attribute extends DoubleStat implements ItemRestriction, GemStoneStat {
|
||||
public class RequiredAttribute extends DoubleStat implements ItemRestriction, GemStoneStat {
|
||||
private final PlayerAttribute attribute;
|
||||
|
||||
// TODO merge with RequiredLevelStat
|
||||
public Required_Attribute(PlayerAttribute attribute) {
|
||||
public RequiredAttribute(PlayerAttribute attribute) {
|
||||
super("REQUIRED_" + attribute.getId().toUpperCase().replace("-", "_"), VersionMaterial.GRAY_DYE.toMaterial(), attribute.getName() + " Requirement (MMOCore)", new String[]{"Amount of " + attribute.getName() + " points the", "player needs to use the item."}, new String[]{"!block", "all"});
|
||||
|
||||
this.attribute = attribute;
|
@ -12,11 +12,11 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
public class Required_Profession extends DoubleStat implements ItemRestriction, GemStoneStat {
|
||||
public class RequiredProfession extends DoubleStat implements ItemRestriction, GemStoneStat {
|
||||
private final Profession profession;
|
||||
|
||||
// TODO merge with RequiredLevelStat
|
||||
public Required_Profession(Profession profession) {
|
||||
public RequiredProfession(Profession profession) {
|
||||
super("PROFESSION_" + profession.getId().toUpperCase().replace("-", "_"), Material.PINK_DYE, profession.getName() + " Requirement (MMOCore)",
|
||||
new String[]{"Amount of " + profession.getName() + " levels the", "player needs to use the item."}, new String[]{"!block", "all"});
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.bukkit.events.MythicMobDeathEvent;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemTier;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.adventure.text.Component;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.LegacyComponent;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.CheckedIngredient;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CheckedRecipe;
|
||||
import net.Indyuce.mmoitems.api.crafting.recipe.CraftingRecipe;
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.SmartGive;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStatus.CraftingQueue;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStatus.CraftingQueue.CraftingInfo;
|
||||
|
@ -7,7 +7,7 @@ import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.edition.NewItemEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
|
@ -17,7 +17,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.stat.data.ParticleData;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.element.Element;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomElementListData;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.stat.type.InternalStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.particle.api.ParticleType;
|
||||
|
@ -5,14 +5,12 @@ import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import io.lumine.mythic.lib.api.util.ItemFactory;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.util.MMOItemReforger;
|
||||
import net.Indyuce.mmoitems.stat.RevisionID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.CustomSound;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
|
@ -15,7 +15,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.recipe.CraftingType;
|
||||
|
@ -2,15 +2,13 @@ package net.Indyuce.mmoitems.gui.listener;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.gui.ItemBrowser;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.ItemEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.RecipeBrowserGUI;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.RecipeEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.RecipeListEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.RecipeListGUI;
|
||||
import net.Indyuce.mmoitems.gui.edition.recipe.recipes.RecipeMakerGUI;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.ReforgeOptions;
|
||||
import net.Indyuce.mmoitems.api.item.util.ConfigItem;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.manager;
|
||||
|
||||
import io.lumine.mythic.lib.UtilityMethods;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.block.CustomBlock;
|
||||
import net.Indyuce.mmoitems.api.droptable.DropTable;
|
||||
|
@ -3,6 +3,7 @@ package net.Indyuce.mmoitems.manager;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.api.ItemSet;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -10,37 +11,40 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class SetManager implements Reloadable {
|
||||
private final Map<String, ItemSet> itemSets = new HashMap<>();
|
||||
private final Map<String, ItemSet> itemSets = new HashMap<>();
|
||||
|
||||
public SetManager() {
|
||||
reload();
|
||||
}
|
||||
public SetManager() {
|
||||
reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
itemSets.clear();
|
||||
public void reload() {
|
||||
itemSets.clear();
|
||||
|
||||
ConfigFile config = new ConfigFile("item-sets");
|
||||
for (String id : config.getConfig().getKeys(false))
|
||||
try {
|
||||
itemSets.put(id, new ItemSet(config.getConfig().getConfigurationSection(id)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load item set '" + id + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
ConfigFile config = new ConfigFile("item-sets");
|
||||
for (String id : config.getConfig().getKeys(false))
|
||||
try {
|
||||
final ConfigurationSection section = config.getConfig().getConfigurationSection(id);
|
||||
if (section == null)
|
||||
throw new IllegalStateException("Item set '%s' is not a valid configuration section.".formatted(id));
|
||||
itemSets.put(id, new ItemSet(section));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load item set '%s': %s".formatted(id, exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
public void register(ItemSet set) {
|
||||
itemSets.put(set.getId(), set);
|
||||
}
|
||||
public void register(ItemSet set) {
|
||||
itemSets.put(set.getId(), set);
|
||||
}
|
||||
|
||||
public boolean has(String id) {
|
||||
return itemSets.containsKey(id);
|
||||
}
|
||||
public boolean has(String id) {
|
||||
return itemSets.containsKey(id);
|
||||
}
|
||||
|
||||
public Collection<ItemSet> getAll() {
|
||||
return itemSets.values();
|
||||
}
|
||||
public Collection<ItemSet> getAll() {
|
||||
return itemSets.values();
|
||||
}
|
||||
|
||||
public ItemSet get(String id) {
|
||||
return itemSets.getOrDefault(id, null);
|
||||
}
|
||||
public ItemSet get(String id) {
|
||||
return itemSets.getOrDefault(id, null);
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@ package net.Indyuce.mmoitems.manager;
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ConfigFile;
|
||||
import net.Indyuce.mmoitems.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmoitems.skill.Shulker_Missile;
|
||||
import net.Indyuce.mmoitems.skill.ShulkerMissile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -81,7 +81,7 @@ public class SkillManager {
|
||||
if (clearBefore)
|
||||
skills.clear();
|
||||
|
||||
MythicLib.plugin.getSkills().registerSkillHandler(new Shulker_Missile());
|
||||
MythicLib.plugin.getSkills().registerSkillHandler(new ShulkerMissile());
|
||||
|
||||
File skillFolder = new File(MMOItems.plugin.getDataFolder() + "/skill");
|
||||
if (!skillFolder.exists()) {
|
||||
|
@ -14,148 +14,160 @@ import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class StatManager {
|
||||
private final Map<String, ItemStat> stats = new LinkedHashMap<>();
|
||||
private final Map<String, ItemStat<?, ?>> stats = new LinkedHashMap<>();
|
||||
|
||||
/*
|
||||
* These lists are sets of stats collected when the stats are registered for
|
||||
* the first time to make their access easier. Check the classes
|
||||
* individually to understand better
|
||||
*/
|
||||
private final Set<DoubleStat> numeric = new HashSet<>();
|
||||
private final Set<ItemRestriction> itemRestriction = new HashSet<>();
|
||||
private final Set<ConsumableItemInteraction> consumableActions = new HashSet<>();
|
||||
private final Set<PlayerConsumable> playerConsumables = new HashSet<>();
|
||||
/*
|
||||
* These lists are sets of stats collected when the stats are registered for
|
||||
* the first time to make their access easier. Check the classes
|
||||
* individually to understand better
|
||||
*/
|
||||
private final Set<DoubleStat> numeric = new HashSet<>();
|
||||
private final Set<ItemRestriction> itemRestriction = new HashSet<>();
|
||||
private final Set<ConsumableItemInteraction> consumableActions = new HashSet<>();
|
||||
private final Set<PlayerConsumable> playerConsumables = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Load default stats using java reflection, get all public static final
|
||||
* fields in the ItemStat and register them as stat instances
|
||||
*/
|
||||
public void load() {
|
||||
for (Field field : ItemStats.class.getFields())
|
||||
try {
|
||||
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && field.get(null) instanceof ItemStat)
|
||||
register((ItemStat) field.get(null));
|
||||
} catch (IllegalArgumentException | IllegalAccessException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Couldn't register stat called '" + field.getName() + "': " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Load default stats using java reflection, get all public static final
|
||||
* fields in the ItemStat and register them as stat instances
|
||||
*/
|
||||
public void load() {
|
||||
for (Field field : ItemStats.class.getFields())
|
||||
try {
|
||||
if (Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers()) && field.get(null) instanceof ItemStat)
|
||||
register((ItemStat<?, ?>) field.get(null));
|
||||
} catch (IllegalArgumentException | IllegalAccessException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Couldn't register stat called '%s'".formatted(field.getName()), exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FictiveNumericStat
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void reload(boolean cleanFirst) {
|
||||
/**
|
||||
* @see FictiveNumericStat
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public void reload(boolean cleanFirst) {
|
||||
// Clean fictive numeric stats before
|
||||
if (cleanFirst)
|
||||
numeric.removeIf(stat -> stat instanceof FictiveNumericStat);
|
||||
|
||||
// Clean fictive numeric stats before
|
||||
if (cleanFirst)
|
||||
for (Iterator<DoubleStat> ite = numeric.iterator(); ite.hasNext(); ) {
|
||||
DoubleStat stat = ite.next();
|
||||
if (stat instanceof FictiveNumericStat)
|
||||
ite.remove();
|
||||
}
|
||||
// Register elemental stats
|
||||
loadElements();
|
||||
}
|
||||
|
||||
// Register elemental stats
|
||||
for (ElementStatType type : ElementStatType.values())
|
||||
for (Element element : MythicLib.plugin.getElements().getAll())
|
||||
numeric.add(new FictiveNumericStat(element, type));
|
||||
}
|
||||
/**
|
||||
* Register all MythicLib elements as stats
|
||||
*/
|
||||
public void loadElements() {
|
||||
for (ElementStatType type : ElementStatType.values()) {
|
||||
for (Element element : MythicLib.plugin.getElements().getAll()) {
|
||||
numeric.add(new FictiveNumericStat(element, type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Collection<ItemStat> getAll() {
|
||||
return stats.values();
|
||||
}
|
||||
public Collection<ItemStat<?, ?>> getAll() {
|
||||
return stats.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of all numeric stats like atk damage, crit strike
|
||||
* chance, max mana... which can be applied on a gem stone. This is
|
||||
* used when applying gem stones to quickly access all the stats
|
||||
* which needs to be applied
|
||||
*/
|
||||
public Set<DoubleStat> getNumericStats() {
|
||||
return numeric;
|
||||
}
|
||||
/**
|
||||
* @return Collection of all numeric stats like atk damage, crit strike
|
||||
* chance, max mana... which can be applied on a gem stone. This is
|
||||
* used when applying gem stones to quickly access all the stats
|
||||
* which needs to be applied
|
||||
*/
|
||||
public Set<DoubleStat> getNumericStats() {
|
||||
return numeric;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of all stats which constitute an item restriction:
|
||||
* required level, required class, soulbound..
|
||||
*/
|
||||
public Set<ItemRestriction> getItemRestrictionStats() {
|
||||
return itemRestriction;
|
||||
}
|
||||
/**
|
||||
* @return Collection of all stats which constitute an item restriction:
|
||||
* required level, required class, soulbound..
|
||||
*/
|
||||
public Set<ItemRestriction> getItemRestrictionStats() {
|
||||
return itemRestriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of all stats implementing a consumable action like
|
||||
* deconstructing, identifying...
|
||||
*/
|
||||
public Set<ConsumableItemInteraction> getConsumableActions() {
|
||||
return consumableActions;
|
||||
}
|
||||
/**
|
||||
* @return Collection of all stats implementing a consumable action like
|
||||
* deconstructing, identifying...
|
||||
*/
|
||||
public Set<ConsumableItemInteraction> getConsumableActions() {
|
||||
return consumableActions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of all stats implementing self consumable like
|
||||
* restore health, mana, hunger...
|
||||
*/
|
||||
public Set<PlayerConsumable> getPlayerConsumables() {
|
||||
return playerConsumables;
|
||||
}
|
||||
/**
|
||||
* @return Collection of all stats implementing self consumable like
|
||||
* restore health, mana, hunger...
|
||||
*/
|
||||
public Set<PlayerConsumable> getPlayerConsumables() {
|
||||
return playerConsumables;
|
||||
}
|
||||
|
||||
public boolean has(String id) {
|
||||
return stats.containsKey(id);
|
||||
}
|
||||
public boolean has(String id) {
|
||||
return stats.containsKey(id);
|
||||
}
|
||||
|
||||
public ItemStat get(String id) {
|
||||
return stats.getOrDefault(id, null);
|
||||
}
|
||||
public ItemStat<?, ?> get(String id) {
|
||||
ItemStat<?, ?> stat = stats.getOrDefault(id, null);
|
||||
if (stat == null)
|
||||
stat = numeric.stream()
|
||||
.filter(doubleStat -> doubleStat.getId().equals(id))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
return stat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a stat in MMOItems
|
||||
*
|
||||
* @param id Useless.
|
||||
* @param stat The stat instance
|
||||
* @deprecated Stat IDs are now stored in the stat instance directly.
|
||||
* Please use StatManager#register(ItemStat) instead
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
public void register(String id, ItemStat stat) {
|
||||
register(stat);
|
||||
}
|
||||
/**
|
||||
* Registers a stat in MMOItems
|
||||
*
|
||||
* @param id Useless.
|
||||
* @param stat The stat instance
|
||||
* @deprecated Stat IDs are now stored in the stat instance directly.
|
||||
* Please use StatManager#register(ItemStat) instead
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
public void register(String id, ItemStat<?, ?> stat) {
|
||||
register(stat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a stat in MMOItems. It must be done right after MMOItems loads
|
||||
* before any manager is initialized because stats are commonly used when
|
||||
* loading configs.
|
||||
*
|
||||
* @param stat The stat to register
|
||||
*/
|
||||
public void register(ItemStat stat) {
|
||||
if (!stat.isEnabled())
|
||||
return;
|
||||
/**
|
||||
* Registers a stat in MMOItems. It must be done right after MMOItems loads
|
||||
* before any manager is initialized because stats are commonly used when
|
||||
* loading configs.
|
||||
*
|
||||
* @param stat The stat to register
|
||||
*/
|
||||
public void register(ItemStat<?, ?> stat) {
|
||||
if (!stat.isEnabled())
|
||||
return;
|
||||
|
||||
stats.put(stat.getId(), stat);
|
||||
stats.put(stat.getId(), stat);
|
||||
|
||||
if (stat instanceof DoubleStat && !(stat instanceof GemStoneStat) && stat.isCompatible(Type.GEM_STONE))
|
||||
numeric.add((DoubleStat) stat);
|
||||
if (stat instanceof DoubleStat && !(stat instanceof GemStoneStat) && stat.isCompatible(Type.GEM_STONE))
|
||||
numeric.add((DoubleStat) stat);
|
||||
|
||||
if (stat instanceof ItemRestriction)
|
||||
itemRestriction.add((ItemRestriction) stat);
|
||||
if (stat instanceof ItemRestriction)
|
||||
itemRestriction.add((ItemRestriction) stat);
|
||||
|
||||
if (stat instanceof ConsumableItemInteraction)
|
||||
consumableActions.add((ConsumableItemInteraction) stat);
|
||||
if (stat instanceof ConsumableItemInteraction)
|
||||
consumableActions.add((ConsumableItemInteraction) stat);
|
||||
|
||||
if (stat instanceof PlayerConsumable)
|
||||
playerConsumables.add((PlayerConsumable) stat);
|
||||
if (stat instanceof PlayerConsumable)
|
||||
playerConsumables.add((PlayerConsumable) stat);
|
||||
|
||||
/**
|
||||
* Cache stat for every type which may have this stat. Really important
|
||||
* otherwise the stat will NOT be used anywhere in the plugin. This
|
||||
* process is also done in the TypeManager when registering new types
|
||||
* but since stats can be registered after types are loaded, we must
|
||||
* take it into account
|
||||
*/
|
||||
if (MMOItems.plugin.getTypes() != null)
|
||||
for (Type type : MMOItems.plugin.getTypes().getAll())
|
||||
if (stat.isCompatible(type))
|
||||
type.getAvailableStats().add(stat);
|
||||
}
|
||||
/*
|
||||
* Cache stat for every type which may have this stat. Really important
|
||||
* otherwise the stat will NOT be used anywhere in the plugin. This
|
||||
* process is also done in the TypeManager when registering new types
|
||||
* but since stats can be registered after types are loaded, we must
|
||||
* take it into account
|
||||
*/
|
||||
if (MMOItems.plugin.getTypes() != null)
|
||||
MMOItems.plugin.getTypes()
|
||||
.getAll()
|
||||
.stream()
|
||||
.filter(stat::isCompatible)
|
||||
.forEach(type -> type.getAvailableStats().add(stat));
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.StringValue;
|
||||
import net.Indyuce.mmoitems.particle.AuraParticles;
|
||||
|
@ -26,16 +26,18 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class Shulker_Missile extends SkillHandler<VectorSkillResult> implements Listener {
|
||||
public Shulker_Missile() {
|
||||
public class ShulkerMissile extends SkillHandler<VectorSkillResult> implements Listener {
|
||||
public ShulkerMissile() {
|
||||
super();
|
||||
|
||||
registerModifiers("damage", "effect-duration", "duration");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public VectorSkillResult getResult(SkillMetadata meta) {
|
||||
return new VectorSkillResult(meta);
|
@ -7,7 +7,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
|
@ -5,28 +5,24 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import net.Indyuce.mmoitems.stat.data.StringData;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.ArrowParticlesEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.ArrowParticlesData;
|
||||
import net.Indyuce.mmoitems.stat.data.ParticleData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
|
@ -8,7 +8,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.interaction.projectile.ArrowPotionEffectArrayItem;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
|
@ -11,7 +11,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemTier;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.DeconstructItemEvent;
|
||||
|
@ -7,7 +7,7 @@ import io.lumine.mythic.lib.api.util.SmartGive;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.IdentifyItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
|
@ -2,11 +2,8 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.ItemTier;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.DeconstructItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
@ -18,16 +15,12 @@ import net.Indyuce.mmoitems.stat.data.GemstoneData;
|
||||
import net.Indyuce.mmoitems.stat.type.BooleanStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
|
||||
import net.Indyuce.mmoitems.util.Pair;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -5,17 +5,14 @@ import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.CommandListEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.CommandData;
|
||||
import net.Indyuce.mmoitems.stat.data.CommandListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.CustomSound;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
@ -14,8 +14,6 @@ import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.SoundsEdition;
|
||||
import net.Indyuce.mmoitems.stat.data.SoundData;
|
||||
import net.Indyuce.mmoitems.stat.data.SoundListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.PlayerConsumable;
|
||||
|
@ -8,7 +8,7 @@ import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
@ -37,200 +37,189 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
public class Effects extends ItemStat<RandomPotionEffectListData, PotionEffectListData> implements PlayerConsumable {
|
||||
public Effects() {
|
||||
super("EFFECTS", Material.POTION, "Effects", new String[]{"The potion effects your", "consumable item grants."},
|
||||
new String[]{"consumable"});
|
||||
}
|
||||
public Effects() {
|
||||
super("EFFECTS", Material.POTION, "Effects", new String[]{"The potion effects your", "consumable item grants."},
|
||||
new String[]{"consumable"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public RandomPotionEffectListData whenInitialized(Object object) {
|
||||
Validate.isTrue(object instanceof ConfigurationSection, "Must specify a config section");
|
||||
return new RandomPotionEffectListData((ConfigurationSection) object);
|
||||
}
|
||||
@Override
|
||||
public RandomPotionEffectListData whenInitialized(Object object) {
|
||||
Validate.isTrue(object instanceof ConfigurationSection, "Must specify a config section");
|
||||
return new RandomPotionEffectListData((ConfigurationSection) object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent event) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStats.EFFECTS).enable("Write in the chat the permanent potion effect you want to add.",
|
||||
ChatColor.AQUA + "Format: {Potion Effect Name}|{Duration Numeric Formula}|{Amplifier Numeric Formula}", ChatColor.DARK_RED + "Note: " + ChatColor.RED + "The '|' lines are literal.");
|
||||
@Override
|
||||
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent event) {
|
||||
if (event.getAction() == InventoryAction.PICKUP_ALL)
|
||||
new StatEdition(inv, ItemStats.EFFECTS).enable("Write in the chat the permanent potion effect you want to add.",
|
||||
ChatColor.AQUA + "Format: {Potion Effect Name}|{Duration Numeric Formula}|{Amplifier Numeric Formula}", ChatColor.DARK_RED + "Note: " + ChatColor.RED + "The '|' lines are literal.");
|
||||
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
if (inv.getEditedSection().contains("effects")) {
|
||||
Set<String> set = inv.getEditedSection().getConfigurationSection("effects").getKeys(false);
|
||||
String last = Arrays.asList(set.toArray(new String[0])).get(set.size() - 1);
|
||||
inv.getEditedSection().set("effects." + last, null);
|
||||
if (set.size() <= 1)
|
||||
inv.getEditedSection().set("effects", null);
|
||||
inv.registerTemplateEdition();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + last.substring(0, 1).toUpperCase()
|
||||
+ last.substring(1).toLowerCase() + ChatColor.GRAY + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getAction() == InventoryAction.PICKUP_HALF) {
|
||||
if (inv.getEditedSection().contains("effects")) {
|
||||
Set<String> set = inv.getEditedSection().getConfigurationSection("effects").getKeys(false);
|
||||
String last = Arrays.asList(set.toArray(new String[0])).get(set.size() - 1);
|
||||
inv.getEditedSection().set("effects." + last, null);
|
||||
if (set.size() <= 1)
|
||||
inv.getEditedSection().set("effects", null);
|
||||
inv.registerTemplateEdition();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + "Successfully removed " + last.substring(0, 1).toUpperCase()
|
||||
+ last.substring(1).toLowerCase() + ChatColor.GRAY + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
String[] split = message.split("\\|");
|
||||
Validate.isTrue(split.length > 1, FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(),"Use this format: $e{Potion Effect Name}|{Duration Numeric Formula}|{Amplifier Numeric Formula}$b."));
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
String[] split = message.split("\\|");
|
||||
Validate.isTrue(split.length > 1, FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), "Use this format: $e{Potion Effect Name}|{Duration Numeric Formula}|{Amplifier Numeric Formula}$b."));
|
||||
|
||||
PotionEffectType effect = PotionEffectType.getByName(split[0].replace("-", "_").replace(" ", "_").toUpperCase());
|
||||
Validate.notNull(effect, split[0] + FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get()," is not a valid potion effect. All potion effects can be found here:$e https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html"));
|
||||
PotionEffectType effect = PotionEffectType.getByName(split[0].replace("-", "_").replace(" ", "_").toUpperCase());
|
||||
Validate.notNull(effect, split[0] + FriendlyFeedbackProvider.quickForConsole(FFPMMOItems.get(), " is not a valid potion effect. All potion effects can be found here:$e https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/potion/PotionEffectType.html"));
|
||||
|
||||
NumericStatFormula duration = new NumericStatFormula(split[1]);
|
||||
NumericStatFormula amplifier = split.length > 2 ? new NumericStatFormula(split[2]) : new NumericStatFormula(1, 0, 0, 0);
|
||||
NumericStatFormula duration = new NumericStatFormula(split[1]);
|
||||
NumericStatFormula amplifier = split.length > 2 ? new NumericStatFormula(split[2]) : new NumericStatFormula(1, 0, 0, 0);
|
||||
|
||||
duration.fillConfigurationSection(inv.getEditedSection(), "effects." + effect.getName() + ".duration");
|
||||
amplifier.fillConfigurationSection(inv.getEditedSection(), "effects." + effect.getName() + ".amplifier");
|
||||
inv.registerTemplateEdition();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + effect.getName() + " " + amplifier + " successfully added.");
|
||||
}
|
||||
duration.fillConfigurationSection(inv.getEditedSection(), "effects." + effect.getName() + ".duration");
|
||||
amplifier.fillConfigurationSection(inv.getEditedSection(), "effects." + effect.getName() + ".amplifier");
|
||||
inv.registerTemplateEdition();
|
||||
inv.getPlayer().sendMessage(MMOItems.plugin.getPrefix() + effect.getName() + " " + amplifier + " successfully added.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenDisplayed(List<String> lore, Optional<RandomPotionEffectListData> statData) {
|
||||
@Override
|
||||
public void whenDisplayed(List<String> lore, Optional<RandomPotionEffectListData> statData) {
|
||||
statData.ifPresentOrElse(randomPotionEffectListData -> {
|
||||
lore.add(ChatColor.GRAY + "Current Value:");
|
||||
for (RandomPotionEffectData effect : randomPotionEffectListData.getEffects())
|
||||
lore.add(ChatColor.GRAY + "* " + ChatColor.GREEN + MMOUtils.caseOnWords(effect.getType().getName().toLowerCase().replace("_", " "))
|
||||
+ ChatColor.GRAY + " Level: " + ChatColor.GREEN + effect.getAmplifier() + ChatColor.GRAY + " Duration: " + ChatColor.GREEN
|
||||
+ effect.getDuration());
|
||||
}, () -> lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "None"));
|
||||
lore.add("");
|
||||
lore.add(ChatColor.YELLOW + AltChar.listDash + " Click to add an effect.");
|
||||
lore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to remove the last effect.");
|
||||
}
|
||||
|
||||
if (statData.isPresent()) {
|
||||
lore.add(ChatColor.GRAY + "Current Value:");
|
||||
RandomPotionEffectListData data = statData.get();
|
||||
for (RandomPotionEffectData effect : data.getEffects())
|
||||
lore.add(ChatColor.GRAY + "* " + ChatColor.GREEN + MMOUtils.caseOnWords(effect.getType().getName().toLowerCase().replace("_", " "))
|
||||
+ ChatColor.GRAY + " Level: " + ChatColor.GREEN + effect.getAmplifier() + ChatColor.GRAY + " Duration: " + ChatColor.GREEN
|
||||
+ effect.getDuration());
|
||||
} else
|
||||
lore.add(ChatColor.GRAY + "Current Value: " + ChatColor.RED + "None");
|
||||
@NotNull
|
||||
@Override
|
||||
public PotionEffectListData getClearStatData() {
|
||||
return new PotionEffectListData();
|
||||
}
|
||||
|
||||
lore.add("");
|
||||
lore.add(ChatColor.YELLOW + AltChar.listDash + " Click to add an effect.");
|
||||
lore.add(ChatColor.YELLOW + AltChar.listDash + " Right click to remove the last effect.");
|
||||
}
|
||||
@Override
|
||||
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull PotionEffectListData data) {
|
||||
// Process Lore
|
||||
List<String> lore = new ArrayList<>();
|
||||
String effectFormat = ItemStat.translate("effect");
|
||||
data.getEffects().forEach(effect -> lore.add(effectFormat
|
||||
.replace("{effect}",
|
||||
MMOItems.plugin.getLanguage().getPotionEffectName(effect.getType())
|
||||
+ (effect.getLevel() < 2 ? "" : " " + MMOUtils.intToRoman(effect.getLevel())))
|
||||
.replace("{duration}", MythicLib.plugin.getMMOConfig().decimal.format(effect.getDuration()))));
|
||||
item.getLore().insert("effects", lore);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PotionEffectListData getClearStatData() {
|
||||
return new PotionEffectListData();
|
||||
}
|
||||
// Add tags to item
|
||||
item.addItemTag(getAppliedNBT(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull PotionEffectListData data) {
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull PotionEffectListData data) {
|
||||
|
||||
// Process Lore
|
||||
List<String> lore = new ArrayList<>();
|
||||
String effectFormat = ItemStat.translate("effect");
|
||||
data.getEffects().forEach(effect -> {
|
||||
lore.add(effectFormat
|
||||
.replace("{effect}",
|
||||
MMOItems.plugin.getLanguage().getPotionEffectName(effect.getType())
|
||||
+ (effect.getLevel() < 2 ? "" : " " + MMOUtils.intToRoman(effect.getLevel())))
|
||||
.replace("{duration}", MythicLib.plugin.getMMOConfig().decimal.format(effect.getDuration())));
|
||||
});
|
||||
item.getLore().insert("effects", lore);
|
||||
// Create aJson Array
|
||||
JsonArray array = new JsonArray();
|
||||
|
||||
// Add tags to item
|
||||
item.addItemTag(getAppliedNBT(data));
|
||||
}
|
||||
// For every effect
|
||||
for (PotionEffectData effect : data.getEffects()) {
|
||||
// Convert to Json Object
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("Type", effect.getType().getName());
|
||||
object.addProperty("Duration", effect.getDuration());
|
||||
object.addProperty("Level", effect.getLevel());
|
||||
array.add(object);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull PotionEffectListData data) {
|
||||
// Make the tag
|
||||
ArrayList<ItemTag> ret = new ArrayList<>();
|
||||
ret.add(new ItemTag(getNBTPath(), array.toString()));
|
||||
|
||||
// Create aJson Array
|
||||
JsonArray array = new JsonArray();
|
||||
// Thats it
|
||||
return ret;
|
||||
}
|
||||
|
||||
// For every effect
|
||||
for (PotionEffectData effect : data.getEffects()) {
|
||||
@Override
|
||||
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
||||
// Find relevant tag
|
||||
ArrayList<ItemTag> relevantTags = new ArrayList<>();
|
||||
if (mmoitem.getNBT().hasTag(getNBTPath()))
|
||||
relevantTags.add(ItemTag.getTagAtPath(getNBTPath(), mmoitem.getNBT(), SupportedNBTTagValues.STRING));
|
||||
|
||||
// Convert to Json Object
|
||||
JsonObject object = new JsonObject();
|
||||
object.addProperty("Type", effect.getType().getName());
|
||||
object.addProperty("Duration", effect.getDuration());
|
||||
object.addProperty("Level", effect.getLevel());
|
||||
array.add(object);
|
||||
}
|
||||
// Attempt to build data
|
||||
StatData data = getLoadedNBT(relevantTags);
|
||||
|
||||
// Make the tag
|
||||
ArrayList<ItemTag> ret = new ArrayList<>();
|
||||
ret.add(new ItemTag(getNBTPath(), array.toString()));
|
||||
// Valid? Append.
|
||||
if (data != null)
|
||||
mmoitem.setData(this, data);
|
||||
}
|
||||
|
||||
// Thats it
|
||||
return ret;
|
||||
}
|
||||
@Nullable
|
||||
@Override
|
||||
public PotionEffectListData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
|
||||
|
||||
@Override
|
||||
public void whenLoaded(@NotNull ReadMMOItem mmoitem) {
|
||||
// Find tag
|
||||
ItemTag rTag = ItemTag.getTagAtPath(getNBTPath(), storedTags);
|
||||
|
||||
// Find relevant tag
|
||||
ArrayList<ItemTag> relevantTags = new ArrayList<>();
|
||||
if (mmoitem.getNBT().hasTag(getNBTPath()))
|
||||
relevantTags.add(ItemTag.getTagAtPath(getNBTPath(), mmoitem.getNBT(), SupportedNBTTagValues.STRING));
|
||||
// Found?
|
||||
if (rTag == null)
|
||||
return null;
|
||||
// Must be Json Array, attempt to parse.
|
||||
try {
|
||||
PotionEffectListData effects = new PotionEffectListData();
|
||||
|
||||
// Attempt to build data
|
||||
StatData data = getLoadedNBT(relevantTags);
|
||||
// Get as Array
|
||||
JsonArray array = new JsonParser().parse((String) rTag.getValue()).getAsJsonArray();
|
||||
|
||||
// Valid? Append.
|
||||
if (data != null) { mmoitem.setData(this, data); }
|
||||
}
|
||||
// BUild each element
|
||||
for (JsonElement e : array) {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PotionEffectListData getLoadedNBT(@NotNull ArrayList<ItemTag> storedTags) {
|
||||
// Must be object
|
||||
if (e.isJsonObject()) {
|
||||
|
||||
// Find tag
|
||||
ItemTag rTag = ItemTag.getTagAtPath(getNBTPath(), storedTags);
|
||||
// Extract
|
||||
JsonObject key = e.getAsJsonObject();
|
||||
|
||||
// Found?
|
||||
if (rTag != null) {
|
||||
effects.add(new PotionEffectData(PotionEffectType.getByName(
|
||||
key.get("Type").getAsString()),
|
||||
key.get("Duration").getAsDouble(),
|
||||
key.get("Level").getAsInt()));
|
||||
}
|
||||
}
|
||||
|
||||
// Must be Json Array, attempt to parse.
|
||||
try {
|
||||
PotionEffectListData effects = new PotionEffectListData();
|
||||
// Success
|
||||
return effects;
|
||||
|
||||
// Get as Array
|
||||
JsonArray array = new JsonParser().parse((String) rTag.getValue()).getAsJsonArray();
|
||||
} catch (JsonSyntaxException | IllegalStateException exception) {
|
||||
/*
|
||||
* OLD ITEM WHICH MUST BE UPDATED.
|
||||
*/
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// BUild each element
|
||||
for (JsonElement e : array) {
|
||||
@Override
|
||||
public void onConsume(@NotNull VolatileMMOItem mmo, @NotNull Player player, boolean vanillaEating) {
|
||||
// Does it have effects?
|
||||
if (!mmo.hasData(ItemStats.EFFECTS))
|
||||
return;
|
||||
|
||||
// Must be object
|
||||
if (e.isJsonObject()) {
|
||||
// Get Data
|
||||
PotionEffectListData pelData = (PotionEffectListData) mmo.getData(ItemStats.EFFECTS);
|
||||
|
||||
// Extract
|
||||
JsonObject key = e.getAsJsonObject();
|
||||
|
||||
effects.add(new PotionEffectData(PotionEffectType.getByName(
|
||||
key.get("Type").getAsString()),
|
||||
key.get("Duration").getAsDouble(),
|
||||
key.get("Level").getAsInt()));
|
||||
}
|
||||
}
|
||||
|
||||
// Success
|
||||
return effects;
|
||||
|
||||
} catch (JsonSyntaxException|IllegalStateException exception) {
|
||||
/*
|
||||
* OLD ITEM WHICH MUST BE UPDATED.
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConsume(@NotNull VolatileMMOItem mmo, @NotNull Player player, boolean vanillaEating) {
|
||||
|
||||
// Does it have effects?
|
||||
if (!mmo.hasData(ItemStats.EFFECTS))
|
||||
return;
|
||||
|
||||
// Get Data
|
||||
PotionEffectListData pelData = (PotionEffectListData) mmo.getData(ItemStats.EFFECTS);
|
||||
|
||||
// Apply
|
||||
for (PotionEffectData ped : pelData.getEffects())
|
||||
if (ped != null) {
|
||||
player.removePotionEffect(ped.getType());
|
||||
player.addPotionEffect(ped.toEffect());
|
||||
}
|
||||
|
||||
}
|
||||
// Apply
|
||||
for (PotionEffectData ped : pelData.getEffects()) {
|
||||
if (ped == null)
|
||||
continue;
|
||||
player.removePotionEffect(ped.getType());
|
||||
player.addPotionEffect(ped.toEffect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythic.lib.element.Element;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
|
@ -9,7 +9,7 @@ import io.lumine.mythic.lib.api.util.ui.PlusMinusPercent;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
@ -20,7 +20,6 @@ import net.Indyuce.mmoitems.comp.enchants.EnchantPlugin;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.EnchantListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomEnchantListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.UpgradeInfo;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
@ -7,7 +7,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
|
@ -1,15 +1,13 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.ItemSet;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.StringData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -20,64 +18,67 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ItemSetStat extends StringStat implements GemStoneStat {
|
||||
public ItemSetStat() {
|
||||
super("SET", Material.LEATHER_CHESTPLATE, "Item Set",
|
||||
new String[] { "Item sets can give to the player extra", "bonuses that depend on how many items", "from the same set your wear." },
|
||||
new String[] { "!gem_stone", "!consumable", "!material", "!block", "!miscellaneous", "all" });
|
||||
}
|
||||
public ItemSetStat() {
|
||||
super("SET", Material.LEATHER_CHESTPLATE, "Item Set",
|
||||
new String[]{"Item sets can give to the player extra", "bonuses that depend on how many items", "from the same set your wear."},
|
||||
new String[]{"!gem_stone", "!consumable", "!material", "!block", "!miscellaneous", "all"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent e) {
|
||||
super.whenClicked(inv, e);
|
||||
if (e.getAction() != InventoryAction.PICKUP_HALF) {
|
||||
inv.getPlayer().sendMessage(ChatColor.GREEN + "Available Item Sets:");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (ItemSet set : MMOItems.plugin.getSets().getAll())
|
||||
builder.append(ChatColor.GREEN).append(set.getId()).append(ChatColor.GRAY)
|
||||
.append(" (").append(set.getName()).append(ChatColor.GRAY).append("), ");
|
||||
if(builder.length() > 1)
|
||||
builder.setLength(builder.length() - 2);
|
||||
inv.getPlayer().sendMessage(builder.toString());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void whenClicked(@NotNull EditionInventory inv, @NotNull InventoryClickEvent e) {
|
||||
super.whenClicked(inv, e);
|
||||
if (e.getAction() != InventoryAction.PICKUP_HALF) {
|
||||
inv.getPlayer().sendMessage(ChatColor.GREEN + "Available Item Sets:");
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (ItemSet set : MMOItems.plugin.getSets().getAll())
|
||||
builder.append(ChatColor.GREEN).append(set.getId()).append(ChatColor.GRAY)
|
||||
.append(" (").append(set.getName()).append(ChatColor.GRAY).append("), ");
|
||||
if (builder.length() > 1)
|
||||
builder.setLength(builder.length() - 2);
|
||||
inv.getPlayer().sendMessage(builder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) {
|
||||
@Override
|
||||
public void whenApplied(@NotNull ItemStackBuilder item, @NotNull StringData data) {
|
||||
|
||||
// Display in lore
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
// Display in lore
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
|
||||
// Apply lore
|
||||
if (set != null) { item.getLore().insert("set", set.getLoreTag()); }
|
||||
// Apply lore
|
||||
if (set != null)
|
||||
item.getLore().insert("set", set.getLoreTag());
|
||||
|
||||
// Add NBT
|
||||
item.addItemTag(getAppliedNBT(data));
|
||||
}
|
||||
// Add NBT
|
||||
item.addItemTag(getAppliedNBT(data));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull StringData data) {
|
||||
@NotNull
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull StringData data) {
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
Validate.notNull(set, "Could not find item set with ID '%s'".formatted(data));
|
||||
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
Validate.notNull(set, "Could not find item set with ID '" + data.toString() + "'");
|
||||
// Make Array
|
||||
ArrayList<ItemTag> ret = new ArrayList<>();
|
||||
|
||||
// Make Array
|
||||
ArrayList<ItemTag> ret = new ArrayList<>();
|
||||
// Add that tag
|
||||
ret.add(new ItemTag(getNBTPath(), data.toString()));
|
||||
|
||||
// Add that tag
|
||||
ret.add(new ItemTag(getNBTPath(), data.toString()));
|
||||
// Thats it
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Thats it
|
||||
return ret;
|
||||
}
|
||||
@Override
|
||||
@NotNull
|
||||
public String getNBTPath() {
|
||||
return "MMOITEMS_ITEM_SET";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull public String getNBTPath() { return "MMOITEMS_ITEM_SET"; }
|
||||
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
ItemSet set = MMOItems.plugin.getSets().get(message);
|
||||
Validate.notNull(set, "Couldn't find the set named '" + message + "'.");
|
||||
super.whenInput(inv, message, info);
|
||||
}
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
ItemSet set = MMOItems.plugin.getSets().get(message);
|
||||
Validate.notNull(set, "Couldn't find the set named '%s'.".formatted(message));
|
||||
super.whenInput(inv, message, info);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.PlayerConsumable;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* mmoitems
|
||||
*
|
||||
* @author Roch Blondiaux
|
||||
* @date 24/10/2022
|
||||
*/
|
||||
public class ManaCost extends DoubleStat implements ItemRestriction, PlayerConsumable {
|
||||
|
||||
public ManaCost() {
|
||||
super("MANA_COST", VersionMaterial.LAPIS_LAZULI.toMaterial(), "Mana Cost", new String[]{"Mana spent by your weapon to be used."}, new String[]{"piercing", "slashing", "blunt", "range"});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canUse(RPGPlayer player, NBTItem item, boolean message) {
|
||||
// No data no service
|
||||
if (!item.hasTag(ItemStats.MANA_COST.getNBTPath()))
|
||||
return true;
|
||||
double manaCost = item.getDouble(ItemStats.MANA_COST.getNBTPath());
|
||||
boolean hasMana = manaCost > 0 && player.getMana() >= manaCost;
|
||||
if (!hasMana)
|
||||
Message.NOT_ENOUGH_MANA.format(ChatColor.RED).send(player.getPlayer());
|
||||
return hasMana;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConsume(@NotNull VolatileMMOItem mmo, @NotNull Player player, boolean vanillaEating) {
|
||||
// No data no service
|
||||
if (!mmo.hasData(ItemStats.MANA_COST)) return;
|
||||
|
||||
// Get value
|
||||
DoubleData d = (DoubleData) mmo.getData(ItemStats.MANA_COST);
|
||||
if (d.getValue() > 0) {
|
||||
final RPGPlayer rpgPlayer = PlayerData.get(player).getRPG();
|
||||
rpgPlayer.setMana(rpgPlayer.getMana() - d.getValue());
|
||||
}
|
||||
}
|
||||
}
|
@ -6,14 +6,12 @@ import io.lumine.mythic.lib.api.util.EnumUtils;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.MaterialData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
@ -21,7 +21,7 @@ import com.google.gson.JsonParser;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
@ -31,7 +31,6 @@ import net.Indyuce.mmoitems.stat.data.PotionEffectData;
|
||||
import net.Indyuce.mmoitems.stat.data.PotionEffectListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomPotionEffectData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomPotionEffectListData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
|
@ -9,7 +9,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
|
||||
|
@ -1,86 +1,67 @@
|
||||
package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.RepairItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.util.RepairUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RepairPower extends DoubleStat implements ConsumableItemInteraction {
|
||||
public RepairPower() {
|
||||
super("REPAIR", Material.ANVIL, "Repair", new String[] { "The amount of durability your item", "can repair when set an item." },
|
||||
new String[] { "consumable" });
|
||||
}
|
||||
public RepairPower() {
|
||||
super("REPAIR", Material.ANVIL, "Repair", new String[]{"The amount of durability your item", "can repair when set an item."},
|
||||
new String[]{"consumable"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleConsumableEffect(@NotNull InventoryClickEvent event, @NotNull PlayerData playerData, @NotNull Consumable consumable, @NotNull NBTItem target, Type targetType) {
|
||||
int repairPower = (int) consumable.getNBTItem().getStat(ItemStats.REPAIR.getId());
|
||||
if (repairPower <= 0)
|
||||
return false;
|
||||
@Override
|
||||
public boolean handleConsumableEffect(@NotNull InventoryClickEvent event, @NotNull PlayerData playerData, @NotNull Consumable consumable, @NotNull NBTItem target, Type targetType) {
|
||||
int repairPower = (int) consumable.getNBTItem().getStat(ItemStats.REPAIR.getId());
|
||||
if (repairPower <= 0)
|
||||
return false;
|
||||
|
||||
// custom durability
|
||||
Player player = playerData.getPlayer();
|
||||
// custom durability
|
||||
Player player = playerData.getPlayer();
|
||||
|
||||
final String type = "MMOITEMS_REPAIR_TYPE";
|
||||
if((target.hasTag(type) || consumable.getNBTItem().hasTag(type)) &&
|
||||
!target.getString(type).equals(consumable.getNBTItem().getString(type))) {
|
||||
Message.UNABLE_TO_REPAIR.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
|
||||
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
|
||||
return false;
|
||||
}
|
||||
final String type = "MMOITEMS_REPAIR_TYPE";
|
||||
if ((target.hasTag(type) || consumable.getNBTItem().hasTag(type)) &&
|
||||
!target.getString(type).equals(consumable.getNBTItem().getString(type))) {
|
||||
Message.UNABLE_TO_REPAIR.format(ChatColor.RED, "#item#", MMOUtils.getDisplayName(target.getItem())).send(player);
|
||||
player.getPlayer().playSound(player.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1.5f);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.hasTag("MMOITEMS_DURABILITY")) {
|
||||
RepairItemEvent called = new RepairItemEvent(playerData, consumable.getMMOItem(), target, repairPower);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled())
|
||||
return false;
|
||||
if (target.hasTag("MMOITEMS_DURABILITY")) {
|
||||
RepairItemEvent called = new RepairItemEvent(playerData, consumable.getMMOItem(), target, repairPower);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled())
|
||||
return false;
|
||||
|
||||
DurabilityItem durItem = new DurabilityItem(player, target);
|
||||
if (durItem.getDurability() < durItem.getMaxDurability()) {
|
||||
target.getItem().setItemMeta(durItem.addDurability(called.getRepaired()).toItem().getItemMeta());
|
||||
Message.REPAIRED_ITEM
|
||||
.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#amount#", String.valueOf(called.getRepaired()))
|
||||
.send(player);
|
||||
CustomSoundListener.playConsumableSound(consumable.getItem(), player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
DurabilityItem durItem = new DurabilityItem(player, target);
|
||||
if (durItem.getDurability() < durItem.getMaxDurability()) {
|
||||
target.getItem().setItemMeta(durItem.addDurability(called.getRepaired()).toItem().getItemMeta());
|
||||
Message.REPAIRED_ITEM
|
||||
.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#amount#", String.valueOf(called.getRepaired()))
|
||||
.send(player);
|
||||
CustomSoundListener.playConsumableSound(consumable.getItem(), player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// vanilla durability
|
||||
if (!target.getBoolean("Unbreakable") && target.getItem().hasItemMeta() && target.getItem().getItemMeta() instanceof Damageable
|
||||
&& ((Damageable) target.getItem().getItemMeta()).getDamage() > 0) {
|
||||
|
||||
RepairItemEvent called = new RepairItemEvent(playerData, consumable.getMMOItem(), target, repairPower);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled())
|
||||
return false;
|
||||
|
||||
ItemMeta meta = target.getItem().getItemMeta();
|
||||
((Damageable) meta).setDamage(Math.max(0, ((Damageable) meta).getDamage() - called.getRepaired()));
|
||||
target.getItem().setItemMeta(meta);
|
||||
Message.REPAIRED_ITEM.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#amount#", "" + called.getRepaired())
|
||||
.send(player);
|
||||
CustomSoundListener.playConsumableSound(consumable.getItem(), player);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
// vanilla durability
|
||||
return RepairUtils.repairPower(playerData, target, consumable, repairPower);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.RepairItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
@ -12,14 +12,13 @@ import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.util.RepairUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@ -65,23 +64,6 @@ public class RepairPowerPercent extends DoubleStat implements ConsumableItemInte
|
||||
}
|
||||
|
||||
// vanilla durability
|
||||
if (!target.getBoolean("Unbreakable") && target.getItem().hasItemMeta() && target.getItem().getItemMeta() instanceof Damageable
|
||||
&& ((Damageable) target.getItem().getItemMeta()).getDamage() > 0) {
|
||||
|
||||
RepairItemEvent called = new RepairItemEvent(playerData, consumable.getMMOItem(), target, repairPower);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled())
|
||||
return false;
|
||||
|
||||
ItemMeta meta = target.getItem().getItemMeta();
|
||||
((Damageable) meta).setDamage(Math.max(0, ((Damageable) meta).getDamage() - called.getRepaired()));
|
||||
target.getItem().setItemMeta(meta);
|
||||
Message.REPAIRED_ITEM.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#amount#", "" + called.getRepaired())
|
||||
.send(player);
|
||||
CustomSoundListener.playConsumableSound(consumable.getItem(), player);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return RepairUtils.repairPower(playerData, target, consumable, repairPower);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.MythicLib;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.MythicLib;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.VolatileMMOItem;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
|
@ -6,7 +6,6 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import net.Indyuce.mmoitems.stat.data.BooleanData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -23,15 +22,12 @@ import org.bukkit.inventory.meta.BlockStateMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.data.ShieldPatternData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.StringStat;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.BreakSoulboundEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
|
@ -3,8 +3,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.ApplySoulboundEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
|
@ -19,7 +19,7 @@ import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
|
@ -2,7 +2,7 @@ package net.Indyuce.mmoitems.stat;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
|
@ -8,7 +8,7 @@ import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.event.item.UpgradeItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
@ -22,7 +22,6 @@ import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.UpgradingEdition;
|
||||
import net.Indyuce.mmoitems.stat.data.UpgradeData;
|
||||
import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ConsumableItemInteraction;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
@ -9,7 +9,7 @@ import io.lumine.mythic.lib.skill.SkillMetadata;
|
||||
import io.lumine.mythic.lib.skill.handler.SkillHandler;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.player.RPGPlayer;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmoitems.stat.data;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.LiveMMOItem;
|
||||
import net.Indyuce.mmoitems.stat.GemUpgradeScaling;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.Indyuce.mmoitems.stat.data;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.skill.RegisteredSkill;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
@ -4,7 +4,7 @@ import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.build.MMOItemBuilder;
|
||||
import net.Indyuce.mmoitems.api.util.NumericStatFormula;
|
||||
import net.Indyuce.mmoitems.stat.data.PotionEffectData;
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
|
@ -10,7 +10,7 @@ import io.lumine.mythic.lib.api.util.ui.PlusMinusPercent;
|
||||
import io.lumine.mythic.lib.api.util.ui.SilentNumbers;
|
||||
import io.lumine.mythic.lib.manager.StatManager;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.UpgradeTemplate;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.build.ItemStackBuilder;
|
||||
|
@ -6,7 +6,7 @@ import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackCategory;
|
||||
import io.lumine.mythic.lib.api.util.ui.FriendlyFeedbackProvider;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.FFPMMOItems;
|
||||
import net.Indyuce.mmoitems.stat.data.*;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package net.Indyuce.mmoitems;
|
||||
package net.Indyuce.mmoitems.util;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@ -8,6 +8,7 @@ import io.lumine.mythic.lib.api.item.ItemTag;
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import io.lumine.mythic.lib.api.item.SupportedNBTTagValues;
|
||||
import io.lumine.mythic.lib.skill.trigger.TriggerType;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -33,6 +34,10 @@ import java.util.*;
|
||||
@SuppressWarnings("unused")
|
||||
public class MMOUtils {
|
||||
|
||||
public MMOUtils() {
|
||||
throw new IllegalArgumentException("This class cannot be instantiated.");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The skull texture URL from a given player head
|
||||
*/
|
@ -0,0 +1,34 @@
|
||||
package net.Indyuce.mmoitems.util;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
* mmoitems
|
||||
*
|
||||
* @author Roch Blondiaux
|
||||
* @date 24/10/2022
|
||||
*/
|
||||
public class PluginUtils {
|
||||
|
||||
public PluginUtils() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static void isDependencyPresent(@NotNull String name, @NotNull Consumer<Void> callback) {
|
||||
if (Bukkit.getPluginManager().getPlugin(name) != null)
|
||||
callback.accept(null);
|
||||
}
|
||||
|
||||
public static void hookDependencyIfPresent(@NotNull String name, @NotNull Consumer<Void> callback) {
|
||||
if (Bukkit.getPluginManager().getPlugin(name) == null)
|
||||
return;
|
||||
callback.accept(null);
|
||||
MMOItems.plugin.getLogger().log(Level.INFO, "Hooked onto %s".formatted(name));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package net.Indyuce.mmoitems.util;
|
||||
|
||||
import io.lumine.mythic.lib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.event.item.RepairItemEvent;
|
||||
import net.Indyuce.mmoitems.api.interaction.Consumable;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.listener.CustomSoundListener;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* mmoitems
|
||||
*
|
||||
* @author Roch Blondiaux
|
||||
* @date 24/10/2022
|
||||
*/
|
||||
public class RepairUtils {
|
||||
|
||||
public RepairUtils() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
|
||||
public static boolean repairPower(@NotNull PlayerData playerData, @NotNull NBTItem target, @NotNull Consumable consumable, double repairPower) {
|
||||
final Player player = playerData.getPlayer();
|
||||
if (!target.getBoolean("Unbreakable") && target.getItem().hasItemMeta() && target.getItem().getItemMeta() instanceof Damageable
|
||||
&& ((Damageable) target.getItem().getItemMeta()).getDamage() > 0) {
|
||||
RepairItemEvent called = new RepairItemEvent(playerData, consumable.getMMOItem(), target, repairPower);
|
||||
Bukkit.getPluginManager().callEvent(called);
|
||||
if (called.isCancelled())
|
||||
return false;
|
||||
|
||||
ItemMeta meta = target.getItem().getItemMeta();
|
||||
((Damageable) meta).setDamage(Math.max(0, ((Damageable) meta).getDamage() - called.getRepaired()));
|
||||
target.getItem().setItemMeta(meta);
|
||||
Message.REPAIRED_ITEM.format(ChatColor.YELLOW,
|
||||
"#item#",
|
||||
MMOUtils.getDisplayName(target.getItem()),
|
||||
"#amount#",
|
||||
String.valueOf(called.getRepaired() == -1 ? called.getRepairedPercent() : called.getRepaired()))
|
||||
.send(player);
|
||||
CustomSoundListener.playConsumableSound(consumable.getItem(), player);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -17,8 +17,26 @@
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<!-- Dependencies -->
|
||||
<dependencies>
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- MMOItems API -->
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems-API</artifactId>
|
||||
<version>${revision}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Build -->
|
||||
<build>
|
||||
<!-- Includes default files in the Bukkit module -->
|
||||
<resources>
|
||||
<resource>
|
||||
@ -28,7 +46,6 @@
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<!-- Completely necessary for dev build deployment -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -92,28 +109,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spigot API -->
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.18-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.Indyuce</groupId>
|
||||
<artifactId>MMOItems-API</artifactId>
|
||||
<version>${revision}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user