mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-23 04:47:34 +01:00
!Small cleanup, added back two elements temporarily
This commit is contained in:
parent
790ebd09a7
commit
ebc830bfaa
@ -25,7 +25,7 @@ import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public enum Element {
|
||||
FIRE(Material.BLAZE_POWDER, "Fire", ChatColor.DARK_RED, new ElementParticle(Particle.FLAME, .05f, 8), new ElementHandler() {
|
||||
FIRE(Material.BLAZE_POWDER, ChatColor.DARK_RED, new ElementParticle(Particle.FLAME, .05f, 8), new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
target.getWorld().spawnParticle(Particle.LAVA, target.getLocation().add(0, target.getHeight() / 2, 0), 14);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 2, .8f);
|
||||
@ -34,7 +34,7 @@ public enum Element {
|
||||
}
|
||||
}, 19, 25),
|
||||
|
||||
ICE(VersionMaterial.SNOWBALL.toMaterial(), "Ice", ChatColor.AQUA, new ElementParticle(Particle.BLOCK_CRACK, .07f, 16, Material.ICE),
|
||||
ICE(VersionMaterial.SNOWBALL.toMaterial(), ChatColor.AQUA, new ElementParticle(Particle.BLOCK_CRACK, .07f, 16, Material.ICE),
|
||||
new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
new BukkitRunnable() {
|
||||
@ -57,7 +57,7 @@ public enum Element {
|
||||
}
|
||||
}, 20, 24),
|
||||
|
||||
WIND(Material.FEATHER, "Wind", ChatColor.GRAY, new ElementParticle(Particle.EXPLOSION_NORMAL, .06f, 8), new ElementHandler() {
|
||||
WIND(Material.FEATHER, ChatColor.GRAY, new ElementParticle(Particle.EXPLOSION_NORMAL, .06f, 8), new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_ENDER_DRAGON_GROWL.toSound(), 2, 2f);
|
||||
Vector vec = target.getLocation().subtract(stats.getPlayer().getLocation()).toVector().normalize().multiply(1.7).setY(.5);
|
||||
@ -74,7 +74,7 @@ public enum Element {
|
||||
}
|
||||
}, 28, 34),
|
||||
|
||||
EARTH(VersionMaterial.OAK_SAPLING.toMaterial(), "Earth", ChatColor.GREEN, new ElementParticle(Particle.BLOCK_CRACK, .05f, 24, Material.DIRT),
|
||||
EARTH(VersionMaterial.OAK_SAPLING.toMaterial(), ChatColor.GREEN, new ElementParticle(Particle.BLOCK_CRACK, .05f, 24, Material.DIRT),
|
||||
new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_GRASS_BREAK, 2, 0);
|
||||
@ -89,23 +89,21 @@ public enum Element {
|
||||
}
|
||||
}, 29, 33),
|
||||
|
||||
THUNDER(VersionMaterial.GUNPOWDER.toMaterial(), "Thunder", ChatColor.YELLOW, new ElementParticle(Particle.FIREWORKS_SPARK, .05f, 8),
|
||||
new ElementHandler() {
|
||||
THUNDER(VersionMaterial.GUNPOWDER.toMaterial(), ChatColor.YELLOW, new ElementParticle(Particle.FIREWORKS_SPARK, .05f, 8), new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_LARGE_BLAST.toSound(), 2, 0);
|
||||
for (Entity entity : target.getNearbyEntities(3, 2, 3))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new ItemAttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats.getPlayer(),
|
||||
(LivingEntity) entity);
|
||||
new ItemAttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats.getPlayer(), (LivingEntity) entity);
|
||||
|
||||
result.addDamage(absolute);
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI / 16)
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, target.getLocation().add(0, target.getHeight() / 2, 0), 0,
|
||||
Math.cos(k), .01, Math.sin(k), .18);
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, target.getLocation().add(0, target.getHeight() / 2, 0), 0, Math.cos(k), .01,
|
||||
Math.sin(k), .18);
|
||||
}
|
||||
}, 30, 32),
|
||||
|
||||
WATER(VersionMaterial.LILY_PAD.toMaterial(), "Water", ChatColor.BLUE, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.WATER),
|
||||
WATER(VersionMaterial.LILY_PAD.toMaterial(), ChatColor.BLUE, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.WATER),
|
||||
new ElementHandler() {
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
ElementListener.weaken(target);
|
||||
@ -123,7 +121,28 @@ public enum Element {
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
}
|
||||
}, 37, 43);
|
||||
}, 37, 43),
|
||||
|
||||
LIGHTNESS(Material.GLOWSTONE_DUST, ChatColor.WHITE, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.WHITE_WOOL),
|
||||
new ElementHandler() {
|
||||
|
||||
@Override
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double damage, double absolute) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}, 38, 42),
|
||||
|
||||
DARKNESS(Material.COAL, ChatColor.DARK_GRAY, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.COAL_BLOCK), new ElementHandler() {
|
||||
|
||||
@Override
|
||||
public void elementAttack(CachedStats stats, ItemAttackResult result, LivingEntity target, double damage, double absolute) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}, 39, 41),
|
||||
|
||||
;
|
||||
|
||||
private final ItemStack item;
|
||||
private final String name;
|
||||
@ -132,12 +151,12 @@ public enum Element {
|
||||
private final ElementHandler handler;
|
||||
private final int damageGuiSlot, defenseGuiSlot;
|
||||
|
||||
private Element(Material material, String name, ChatColor color, ElementParticle particle, ElementHandler handler, int damageGuiSlot,
|
||||
int defenseGuiSlot) {
|
||||
private Element(Material material, ChatColor color, ElementParticle particle, ElementHandler handler, int damageGuiSlot, int defenseGuiSlot) {
|
||||
this.item = new ItemStack(material);
|
||||
this.name = name;
|
||||
this.name = MMOUtils.caseOnWords(name().toLowerCase());
|
||||
this.color = color;
|
||||
this.particle = particle;
|
||||
|
||||
this.handler = handler;
|
||||
this.damageGuiSlot = damageGuiSlot;
|
||||
this.defenseGuiSlot = defenseGuiSlot;
|
||||
|
@ -17,7 +17,7 @@ import net.Indyuce.mmoitems.stat.data.GemstoneData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.Mergeable;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class GemStone extends UseItem {
|
||||
@ -78,7 +78,7 @@ public class GemStone extends UseItem {
|
||||
* Only applies NON PROPER and MERGEABLE item stats
|
||||
*/
|
||||
for (ItemStat stat : mmoitem.getStats())
|
||||
if (!(stat instanceof ProperStat)) {
|
||||
if (!(stat instanceof GemStoneStat)) {
|
||||
StatData data = mmoitem.getData(stat);
|
||||
if (data instanceof Mergeable) {
|
||||
if (targetMMO.hasData(stat))
|
||||
|
@ -36,7 +36,6 @@ import net.Indyuce.mmoitems.api.ability.Ability.CastingMode;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
||||
import net.Indyuce.mmoitems.api.droptable.item.MMOItemDropItem;
|
||||
import net.Indyuce.mmoitems.api.item.mmoitem.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.item.template.loot.ClassFilter;
|
||||
import net.Indyuce.mmoitems.api.item.template.loot.LootBuilder;
|
||||
import net.Indyuce.mmoitems.api.item.template.loot.TypeFilter;
|
||||
@ -97,7 +96,6 @@ public class MMOItemsCommand implements CommandExecutor {
|
||||
sender.sendMessage(ChatColor.RED + "-level:<level> " + ChatColor.GRAY + "uses a specific item level");
|
||||
sender.sendMessage(ChatColor.RED + "-tier:<tier> " + ChatColor.GRAY + "uses a specific item tier");
|
||||
sender.sendMessage(ChatColor.RED + "-type:<type> " + ChatColor.GRAY + "finds an item with a specific item type");
|
||||
sender.sendMessage(ChatColor.RED + "-id:<id> " + ChatColor.GRAY + "finds a specific item");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -120,22 +118,6 @@ public class MMOItemsCommand implements CommandExecutor {
|
||||
? MMOItems.plugin.getTiers().getOrThrow(handler.getValue("tier").toUpperCase().replace("-", "_"))
|
||||
: MMOItems.plugin.getTemplates().rollTier();
|
||||
|
||||
// no need to use a LootBuilder
|
||||
if (handler.hasArgument("id")) {
|
||||
Validate.isTrue(handler.hasArgument("type"), "You must specify a type as well.");
|
||||
String format = handler.getValue("type");
|
||||
Validate.isTrue(Type.isValid(format), "Could not find type with ID '" + format + "'");
|
||||
Type type = Type.get(format);
|
||||
|
||||
String id = handler.getValue("id").toUpperCase().replace("-", "_");
|
||||
Validate.isTrue(MMOItems.plugin.getTemplates().hasTemplate(type, id), "Could not find gen item with ID '" + id + "'");
|
||||
MMOItemTemplate template = MMOItems.plugin.getTemplates().getTemplate(type, id);
|
||||
ItemStack item = template.newBuilder(itemLevel, itemTier).build().newBuilder().build();
|
||||
Validate.isTrue(item != null && item.getType() != Material.AIR, "Could not generate gen item with ID '" + id + "'");
|
||||
new SmartGive(give).give(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
LootBuilder builder = new LootBuilder(itemLevel, itemTier);
|
||||
if (handler.hasArgument("matchclass"))
|
||||
builder.applyFilter(new ClassFilter(rpgPlayer));
|
||||
|
@ -15,7 +15,7 @@ import net.Indyuce.mmoitems.stat.type.AttributeStat;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
|
||||
public class StatManager {
|
||||
private final Map<String, ItemStat> stats = new LinkedHashMap<>();
|
||||
@ -109,7 +109,7 @@ public class StatManager {
|
||||
|
||||
stats.put(stat.getId(), stat);
|
||||
|
||||
if (stat instanceof DoubleStat && !(stat instanceof ProperStat) && stat.isCompatible(Type.GEM_STONE))
|
||||
if (stat instanceof DoubleStat && !(stat instanceof GemStoneStat) && stat.isCompatible(Type.GEM_STONE))
|
||||
numeric.add((DoubleStat) stat);
|
||||
|
||||
if (stat instanceof AttributeStat)
|
||||
|
@ -8,11 +8,11 @@ import net.Indyuce.mmoitems.api.item.mmoitem.ReadMMOItem;
|
||||
import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
public class CustomModelData extends DoubleStat implements ProperStat {
|
||||
public class CustomModelData extends DoubleStat implements GemStoneStat {
|
||||
public CustomModelData() {
|
||||
super("CUSTOM_MODEL_DATA", new ItemStack(Material.PAINTING), "Custom Model Data", new String[] { "Your 1.14+ model data." }, new String[] { "!block", "all" });
|
||||
|
||||
|
@ -23,11 +23,11 @@ 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.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
|
||||
public class CustomSounds extends ItemStat implements ProperStat {
|
||||
public class CustomSounds extends ItemStat implements GemStoneStat {
|
||||
public CustomSounds() {
|
||||
super("SOUNDS", new ItemStack(Material.JUKEBOX), "Custom Sounds", new String[] { "The custom sounds your item will use." },
|
||||
new String[] { "all" });
|
||||
|
@ -10,9 +10,9 @@ import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
|
||||
public class ItemDamage extends DoubleStat implements ProperStat {
|
||||
public class ItemDamage extends DoubleStat implements GemStoneStat {
|
||||
public ItemDamage() {
|
||||
super("DURABILITY", new ItemStack(Material.FISHING_ROD), "Item Damage",
|
||||
new String[] { "Default item damage. This does &cNOT", "impact the item's max durability." }, new String[] { "!block", "all" });
|
||||
|
@ -22,13 +22,13 @@ import net.Indyuce.mmoitems.stat.data.StringListData;
|
||||
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.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class Lore extends ItemStat implements ProperStat {
|
||||
public class Lore extends ItemStat implements GemStoneStat {
|
||||
public Lore() {
|
||||
super("LORE", new ItemStack(VersionMaterial.WRITABLE_BOOK.toMaterial()), "Lore", new String[] { "The item lore." }, new String[] { "all" });
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ import net.Indyuce.mmoitems.stat.data.DoubleData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class MaximumDurability extends DoubleStat implements ItemRestriction, ProperStat {
|
||||
public class MaximumDurability extends DoubleStat implements ItemRestriction, GemStoneStat {
|
||||
public MaximumDurability() {
|
||||
super("MAX_DURABILITY", new ItemStack(Material.SHEARS), "Maximum Durability", new String[] { "The amount of uses before your", "item becomes unusable/breaks." }, new String[] { "!block", "all"});
|
||||
}
|
||||
|
@ -24,13 +24,13 @@ import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class Permission extends ItemStat implements ItemRestriction, ProperStat {
|
||||
public class Permission extends ItemStat implements ItemRestriction, GemStoneStat {
|
||||
public Permission() {
|
||||
super("PERMISSION", new ItemStack(VersionMaterial.OAK_SIGN.toMaterial()), "Permission",
|
||||
new String[] { "The permission needed to use this item." }, new String[] { "!block", "all" });
|
||||
|
@ -24,13 +24,13 @@ import net.Indyuce.mmoitems.stat.data.random.RandomStatData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemRestriction;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class RequiredClass extends ItemStat implements ItemRestriction, ProperStat {
|
||||
public class RequiredClass extends ItemStat implements ItemRestriction, GemStoneStat {
|
||||
public RequiredClass() {
|
||||
super("REQUIRED_CLASS", new ItemStack(VersionMaterial.WRITABLE_BOOK.toMaterial()), "Required Class",
|
||||
new String[] { "The class you need to", "profess to use your item." }, new String[] { "!block", "all" });
|
||||
|
@ -6,11 +6,11 @@ import net.Indyuce.mmoitems.stat.data.StoredTagsData;
|
||||
import net.Indyuce.mmoitems.stat.data.type.StatData;
|
||||
import net.Indyuce.mmoitems.stat.type.InternalStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class StoredTags extends InternalStat implements ProperStat {
|
||||
public class StoredTags extends InternalStat implements GemStoneStat {
|
||||
public StoredTags() {
|
||||
super("STORED_TAGS", VersionMaterial.OAK_SIGN.toItem(), "Stored Tags",
|
||||
new String[] { "You found a secret dev easter egg", "introduced during the 2020 epidemic!" }, new String[] { "all" });
|
||||
|
@ -4,9 +4,9 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat;
|
||||
import net.Indyuce.mmoitems.stat.type.ProperStat;
|
||||
import net.Indyuce.mmoitems.stat.type.GemStoneStat;
|
||||
|
||||
public class SuccessRate extends DoubleStat implements ProperStat {
|
||||
public class SuccessRate extends DoubleStat implements GemStoneStat {
|
||||
|
||||
/*
|
||||
* in a different class because Success Rate is meant to be a proper stat
|
||||
|
@ -0,0 +1,15 @@
|
||||
package net.Indyuce.mmoitems.stat.type;
|
||||
|
||||
/**
|
||||
* Statistics which must NOT be applied onto an item when socketing the gem
|
||||
* stone. For instance, 'Success Rate' is a gem stone stat but it must not be
|
||||
* transfered onto the item.
|
||||
*
|
||||
* @author cympe
|
||||
*/
|
||||
public interface GemStoneStat {
|
||||
|
||||
/*
|
||||
* No method is required.
|
||||
*/
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package net.Indyuce.mmoitems.stat.type;
|
||||
|
||||
/**
|
||||
* Proper statistics are gem stone statistics which must NOT be applied onto an
|
||||
* item when socketing the gem stone. For instance, 'Success Rate' is a gem
|
||||
* stone stat but it must not be transfered onto the item.
|
||||
*
|
||||
* @author cympe
|
||||
*/
|
||||
public interface ProperStat {
|
||||
|
||||
/*
|
||||
* No method is required.
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user