mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-02-26 15:21:22 +01:00
MMOLib update 1
This commit is contained in:
parent
df17d4676d
commit
38bc71326f
@ -58,7 +58,6 @@ import net.Indyuce.mmoitems.manager.AbilityManager;
|
||||
import net.Indyuce.mmoitems.manager.BlockManager;
|
||||
import net.Indyuce.mmoitems.manager.ConfigManager;
|
||||
import net.Indyuce.mmoitems.manager.CraftingManager;
|
||||
import net.Indyuce.mmoitems.manager.StandaloneDamageManager;
|
||||
import net.Indyuce.mmoitems.manager.DropTableManager;
|
||||
import net.Indyuce.mmoitems.manager.EntityManager;
|
||||
import net.Indyuce.mmoitems.manager.ItemManager;
|
||||
@ -71,19 +70,16 @@ import net.Indyuce.mmoitems.manager.TypeManager;
|
||||
import net.Indyuce.mmoitems.manager.UpdaterManager;
|
||||
import net.Indyuce.mmoitems.manager.UpgradeManager;
|
||||
import net.Indyuce.mmoitems.manager.WorldGenManager;
|
||||
import net.Indyuce.mmoitems.version.ServerVersion;
|
||||
import net.Indyuce.mmoitems.version.SpigotPlugin;
|
||||
import net.Indyuce.mmoitems.version.nms.NMSHandler;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.SpigotPlugin;
|
||||
|
||||
public class MMOItems extends JavaPlugin {
|
||||
public static MMOItems plugin;
|
||||
|
||||
private ServerVersion version;
|
||||
private RecipeManager recipeManager;
|
||||
private ConfigManager configManager;
|
||||
private StatManager statManager;
|
||||
private EntityManager entityManager;
|
||||
private StandaloneDamageManager damageManager;
|
||||
private DropTableManager dropTableManager;
|
||||
private UpdaterManager itemUpdaterManager;
|
||||
private TypeManager typeManager;
|
||||
@ -102,23 +98,12 @@ public class MMOItems extends JavaPlugin {
|
||||
private HologramSupport hologramSupport;
|
||||
private FlagPlugin flagPlugin = new DefaultFlags();
|
||||
private PlayerInventory inventory = new DefaultPlayerInventory();
|
||||
private NMSHandler nms;
|
||||
|
||||
public void onLoad() {
|
||||
plugin = this;
|
||||
version = new ServerVersion(Bukkit.getServer().getClass());
|
||||
|
||||
try {
|
||||
getLogger().log(Level.INFO, "Detected Bukkit Version: " + version.toString());
|
||||
nms = (NMSHandler) Class.forName("net.Indyuce.mmoitems.version.nms.NMSHandler_" + version.toString().substring(1)).newInstance();
|
||||
} catch (Exception e) {
|
||||
getLogger().log(Level.INFO, "Your server version is not compatible.");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (getServer().getPluginManager().getPlugin("WorldGuard") != null && version.isStrictlyHigher(1, 12)) {
|
||||
if (getServer().getPluginManager().getPlugin("WorldGuard") != null && MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) {
|
||||
flagPlugin = new WorldGuardFlags();
|
||||
getLogger().log(Level.INFO, "Hooked onto WorldGuard");
|
||||
}
|
||||
@ -135,15 +120,6 @@ public class MMOItems extends JavaPlugin {
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
|
||||
/*
|
||||
* server version compatibility checks are ran when the plugin loads. if
|
||||
* the nms object is null, it means the version is not compatible
|
||||
* therefore MI should not enable
|
||||
*/
|
||||
if (nms == null)
|
||||
return;
|
||||
|
||||
new SpigotPlugin(39267, this).checkForUpdate();
|
||||
|
||||
new MMOItemsMetrics();
|
||||
@ -159,7 +135,7 @@ public class MMOItems extends JavaPlugin {
|
||||
tierManager = new TierManager();
|
||||
setManager = new SetManager();
|
||||
upgradeManager = new UpgradeManager();
|
||||
if (version.isStrictlyHigher(1, 12)) {
|
||||
if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) {
|
||||
worldGenManager = new WorldGenManager();
|
||||
blockManager = new BlockManager();
|
||||
}
|
||||
@ -168,7 +144,6 @@ public class MMOItems extends JavaPlugin {
|
||||
stationRecipeManager.reload();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(entityManager = new EntityManager(), this);
|
||||
Bukkit.getPluginManager().registerEvents(damageManager = new StandaloneDamageManager(), this);
|
||||
Bukkit.getPluginManager().registerEvents(dropTableManager = new DropTableManager(), this);
|
||||
Bukkit.getPluginManager().registerEvents(itemUpdaterManager = new UpdaterManager(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ItemUse(), this);
|
||||
@ -179,7 +154,7 @@ public class MMOItems extends JavaPlugin {
|
||||
Bukkit.getPluginManager().registerEvents(new DisableInteractions(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new GuiListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new ElementListener(), this);
|
||||
if (version.isStrictlyHigher(1, 12)) {
|
||||
if (MMOLib.plugin.getVersion().isStrictlyHigher(1, 12)) {
|
||||
Bukkit.getPluginManager().registerEvents(new CustomBlockListener(), this);
|
||||
Bukkit.getPluginManager().registerEvents(new Listener_v1_13(), this);
|
||||
}
|
||||
@ -325,10 +300,6 @@ public class MMOItems extends JavaPlugin {
|
||||
return setManager;
|
||||
}
|
||||
|
||||
public NMSHandler getNMS() {
|
||||
return nms;
|
||||
}
|
||||
|
||||
public FlagPlugin getFlags() {
|
||||
return flagPlugin;
|
||||
}
|
||||
@ -357,10 +328,6 @@ public class MMOItems extends JavaPlugin {
|
||||
inventory = value;
|
||||
}
|
||||
|
||||
public ServerVersion getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public StatManager getStats() {
|
||||
return statManager;
|
||||
}
|
||||
@ -373,10 +340,6 @@ public class MMOItems extends JavaPlugin {
|
||||
return entityManager;
|
||||
}
|
||||
|
||||
public StandaloneDamageManager getDamage() {
|
||||
return damageManager;
|
||||
}
|
||||
|
||||
public DropTableManager getDropTables() {
|
||||
return dropTableManager;
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ import com.mojang.authlib.properties.Property;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class MMOUtils {
|
||||
private static final Random random = new Random();
|
||||
@ -112,7 +113,7 @@ public class MMOUtils {
|
||||
for (ItemStack item : new ItemStack[] { player.getInventory().getItemInMainHand(), player.getInventory().getItemInOffHand() }) {
|
||||
if (item.getType() != Material.AIR)
|
||||
normal++;
|
||||
if (MMOItems.plugin.getNMS().getNBTItem(item).getBoolean("MMOITEMS_TWO_HANDED"))
|
||||
if (MMOLib.plugin.getNMS().getNBTItem(item).getBoolean("MMOITEMS_TWO_HANDED"))
|
||||
twoHanded++;
|
||||
}
|
||||
return twoHanded > 0 && normal > 1;
|
||||
@ -193,7 +194,7 @@ public class MMOUtils {
|
||||
if (target instanceof Player && (!MMOItems.plugin.getLanguage().abilityPlayerDamage || !MMOItems.plugin.getFlags().isPvpAllowed(target.getLocation())))
|
||||
return false;
|
||||
|
||||
return loc == null ? true : MMOItems.plugin.getNMS().isInBoundingBox(target, loc);
|
||||
return loc == null ? true : MMOLib.plugin.getNMS().isInBoundingBox(target, loc);
|
||||
}
|
||||
|
||||
public static String intToRoman(int input) {
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Black_Hole extends Ability {
|
||||
public Black_Hole() {
|
||||
@ -27,7 +27,7 @@ public class Black_Hole extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
|
@ -8,10 +8,10 @@ import org.bukkit.Particle;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Blink extends Ability {
|
||||
public Blink() {
|
||||
@ -24,7 +24,7 @@ public class Blink extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, stats.getPlayer().getLocation().add(0, 1, 0), 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SPELL_INSTANT, stats.getPlayer().getLocation().add(0, 1, 0), 32, 0, 0, 0, .1);
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 1);
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Blizzard extends Ability implements Listener {
|
||||
@ -30,7 +30,7 @@ public class Blizzard extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double force = data.getModifier("force");
|
||||
double inaccuracy = data.getModifier("inaccuracy");
|
||||
|
@ -11,10 +11,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Bouncy_Fireball extends Ability {
|
||||
public Bouncy_Fireball() {
|
||||
@ -30,7 +30,7 @@ public class Bouncy_Fireball extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_SNOWBALL_THROW, 2, 0);
|
||||
new BukkitRunnable() {
|
||||
int j = 0;
|
||||
@ -74,7 +74,7 @@ public class Bouncy_Fireball extends Ability {
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).setFireTicks((int) (ignite * 20));
|
||||
}
|
||||
|
||||
|
@ -15,10 +15,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Bunny_Mode extends Ability implements Listener {
|
||||
private Map<UUID, Long> fallDamage = new HashMap<UUID, Long>();
|
||||
@ -35,7 +35,7 @@ public class Bunny_Mode extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 20;
|
||||
double y = data.getModifier("jump-force");
|
||||
double xz = data.getModifier("speed");
|
||||
|
@ -12,10 +12,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Burning_Hands extends Ability implements Listener {
|
||||
public Burning_Hands() {
|
||||
@ -29,7 +29,7 @@ public class Burning_Hands extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double damage = data.getModifier("damage") / 2;
|
||||
|
||||
@ -58,7 +58,7 @@ public class Burning_Hands extends Ability implements Listener {
|
||||
if (entity.getLocation().distanceSquared(loc) < 60)
|
||||
if (stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
|
@ -11,8 +11,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Chicken_Wraith extends Ability implements Listener {
|
||||
@ -29,7 +29,7 @@ public class Chicken_Wraith extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double force = data.getModifier("force");
|
||||
double inaccuracy = data.getModifier("inaccuracy");
|
||||
|
@ -11,10 +11,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Circular_Slash extends Ability {
|
||||
public Circular_Slash() {
|
||||
@ -29,7 +29,7 @@ public class Circular_Slash extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double radius = data.getModifier("radius");
|
||||
double knockback = data.getModifier("knockback");
|
||||
@ -38,7 +38,7 @@ public class Circular_Slash extends Ability {
|
||||
stats.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 2, 254));
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius)) {
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
Vector v1 = entity.getLocation().toVector();
|
||||
Vector v2 = stats.getPlayer().getLocation().toVector();
|
||||
double y = .5;
|
||||
|
@ -10,11 +10,12 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Contamination extends Ability {
|
||||
public Contamination() {
|
||||
@ -28,7 +29,7 @@ public class Contamination extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -48,7 +49,7 @@ public class Contamination extends Ability {
|
||||
if (j >= duration)
|
||||
cancel();
|
||||
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(ti / 3) * 5, 0, Math.sin(ti / 3) * 5), Color.PURPLE);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(ti / 3) * 5, 0, Math.sin(ti / 3) * 5), Color.PURPLE);
|
||||
for (int j = 0; j < 3; j++) {
|
||||
ti += Math.PI / 32;
|
||||
double r = Math.sin(ti / 2) * 4;
|
||||
@ -60,7 +61,7 @@ public class Contamination extends Ability {
|
||||
loc.getWorld().playSound(loc, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 2, 1);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= 25)
|
||||
MMOItems.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, new AttackResult(dps, DamageType.SKILL, DamageType.MAGICAL).applySkillEffects(stats, (LivingEntity) entity), false);
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), (LivingEntity) entity, new ItemAttackResult(dps, DamageType.SKILL, DamageType.MAGICAL).applySkillEffects(stats, (LivingEntity) entity), false);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
@ -8,14 +8,14 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Corrupt extends Ability {
|
||||
public Corrupt() {
|
||||
@ -30,7 +30,7 @@ public class Corrupt extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -48,12 +48,12 @@ public class Corrupt extends Ability {
|
||||
Location loc1 = loc.clone().add(Math.cos(j) * radius, 1, Math.sin(j) * radius);
|
||||
double y_max = .5 + random.nextDouble();
|
||||
for (double y = 0; y < y_max; y += .1)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc1.clone().add(0, y, 0), Color.PURPLE);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc1.clone().add(0, y, 0), Color.PURPLE);
|
||||
}
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.WITHER);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.WITHER, (int) (duration * 20), (int) amplifier));
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Corrupted_Fangs extends Ability implements Listener {
|
||||
public Corrupted_Fangs() {
|
||||
@ -30,7 +30,7 @@ public class Corrupted_Fangs extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage1 = data.getModifier("damage");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
@ -63,7 +63,7 @@ public class Corrupted_Fangs extends Ability implements Listener {
|
||||
Object[] data = MMOItems.plugin.getEntities().getEntityData(damager);
|
||||
TemporaryStats stats = (TemporaryStats) data[0];
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), event.getEntity()))
|
||||
new AttackResult((double) data[1], DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) event.getEntity());
|
||||
new ItemAttackResult((double) data[1], DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) event.getEntity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Cursed_Beam extends Ability {
|
||||
public Cursed_Beam() {
|
||||
@ -33,7 +33,7 @@ public class Cursed_Beam extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
@ -66,7 +66,7 @@ public class Cursed_Beam extends Ability {
|
||||
|
||||
for (Entity entity : entities)
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation().add(0, 1, 0)) < 9) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (duration * 20), 0));
|
||||
}
|
||||
cancel();
|
||||
|
@ -16,10 +16,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Earthquake extends Ability {
|
||||
public Earthquake() {
|
||||
@ -34,7 +34,7 @@ public class Earthquake extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (!stats.getPlayer().isOnGround()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -62,7 +62,7 @@ public class Earthquake extends Ability {
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Explosive_Turkey extends Ability implements Listener {
|
||||
public Explosive_Turkey() {
|
||||
@ -37,7 +37,7 @@ public class Explosive_Turkey extends Ability implements Listener {
|
||||
Chicken chicken = null;
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double damage = data.getModifier("damage");
|
||||
double radiusSquared = Math.pow(data.getModifier("radius"), 2);
|
||||
@ -88,7 +88,7 @@ public class Explosive_Turkey extends Ability implements Listener {
|
||||
chicken.getWorld().playSound(chicken.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 2, 1.5f);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(chicken.getLocation()))
|
||||
if (!entity.isDead() && entity.getLocation().distanceSquared(chicken.getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().toVector().subtract(chicken.getLocation().toVector()).multiply(.1 * knockback).setY(.4 * knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -12,11 +12,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Fire_Meteor extends Ability {
|
||||
public Fire_Meteor() {
|
||||
@ -31,7 +31,7 @@ public class Fire_Meteor extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 3, 1);
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
@ -57,7 +57,7 @@ public class Fire_Meteor extends Ability {
|
||||
double radius = data.getModifier("radius");
|
||||
for (Entity entity : loc.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < radius * radius) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().toVector().subtract(loc.toVector()).multiply(.1 * knockback).setY(.4 * knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -13,11 +13,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Firebolt extends Ability {
|
||||
public Firebolt() {
|
||||
@ -31,7 +31,7 @@ public class Firebolt extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
new BukkitRunnable() {
|
||||
Vector vec = getTargetDirection(stats.getPlayer(), target).multiply(.8);
|
||||
@ -59,7 +59,7 @@ public class Firebolt extends Ability {
|
||||
loc.getWorld().spawnParticle(Particle.LAVA, loc, 8, 0, 0, 0, 0);
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 3, 1);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
target.setFireTicks((int) data.getModifier("ignite") * 20);
|
||||
cancel();
|
||||
return;
|
||||
|
@ -12,11 +12,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Firefly extends Ability {
|
||||
public Firefly() {
|
||||
@ -31,7 +31,7 @@ public class Firefly extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 20;
|
||||
|
||||
new BukkitRunnable() {
|
||||
@ -62,7 +62,7 @@ public class Firefly extends Ability {
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.FLAME, stats.getPlayer().getLocation().add(0, 1, 0), 24, 0, 0, 0, .3);
|
||||
entity.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback));
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getEyeLocation().getDirection().multiply(-3).setY(.5));
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Freezing_Curse extends Ability {
|
||||
public Freezing_Curse() {
|
||||
@ -32,7 +32,7 @@ public class Freezing_Curse extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -65,7 +65,7 @@ public class Freezing_Curse extends Ability {
|
||||
double damage = data.getModifier("damage");
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (duration * 20), (int) amplifier));
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Frog_Mode extends Ability implements Listener {
|
||||
public Frog_Mode() {
|
||||
@ -26,7 +26,7 @@ public class Frog_Mode extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 20;
|
||||
double y = data.getModifier("jump-force");
|
||||
double xz = data.getModifier("speed");
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Frozen_Aura extends Ability implements Listener {
|
||||
@ -29,7 +29,7 @@ public class Frozen_Aura extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 20;
|
||||
double radiusSquared = Math.pow(data.getModifier("radius"), 2);
|
||||
double amplifier = data.getModifier("amplifier") - 1;
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Grand_Heal extends Ability {
|
||||
@ -24,7 +24,7 @@ public class Grand_Heal extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double heal = data.getModifier("heal");
|
||||
double radius = data.getModifier("radius");
|
||||
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Heal extends Ability {
|
||||
@ -21,7 +21,7 @@ public class Heal extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 2);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.HEART, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.VILLAGER_HAPPY, stats.getPlayer().getLocation().add(0, .75, 0), 16, 1, 1, 1, 0);
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Heavy_Charge extends Ability {
|
||||
public Heavy_Charge() {
|
||||
@ -27,7 +27,7 @@ public class Heavy_Charge extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double knockback = data.getModifier("knockback");
|
||||
|
||||
new BukkitRunnable() {
|
||||
@ -50,7 +50,7 @@ public class Heavy_Charge extends Ability {
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
|
||||
target.setVelocity(stats.getPlayer().getVelocity().setY(0.3).multiply(1.7 * knockback));
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().setX(0).setY(0).setZ(0));
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
cancel();
|
||||
break;
|
||||
}
|
||||
|
@ -11,9 +11,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Hoearthquake extends Ability {
|
||||
public Hoearthquake() {
|
||||
@ -23,12 +24,12 @@ public class Hoearthquake extends Ability {
|
||||
addModifier("mana", 0);
|
||||
addModifier("stamina", 0);
|
||||
|
||||
if (!MMOItems.plugin.getVersion().isBelowOrEqual(1, 12))
|
||||
if (!MMOLib.plugin.getVersion().isBelowOrEqual(1, 12))
|
||||
disable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (!stats.getPlayer().isOnGround()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -13,11 +13,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Holy_Missile extends Ability {
|
||||
public Holy_Missile() {
|
||||
@ -31,7 +31,7 @@ public class Holy_Missile extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double damage = data.getModifier("damage");
|
||||
|
||||
@ -63,7 +63,7 @@ public class Holy_Missile extends Ability {
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 1);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 32, 0, 0, 0, .2);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -16,11 +16,12 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Ice_Crystal extends Ability {
|
||||
public Ice_Crystal() {
|
||||
@ -35,7 +36,7 @@ public class Ice_Crystal extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);
|
||||
new BukkitRunnable() {
|
||||
Vector vec = getTargetDirection(stats.getPlayer(), target).multiply(.45);
|
||||
@ -63,7 +64,7 @@ public class Ice_Crystal extends Ability {
|
||||
for (double a = 0; a < Math.PI * 2; a += Math.PI / 2) {
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(r * Math.cos(a + (double) ti / 10), r * Math.sin(a + (double) ti / 10), 0), loc);
|
||||
loc.add(vec);
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc, .7f, Color.WHITE);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc, .7f, Color.WHITE);
|
||||
loc.add(vec.multiply(-1));
|
||||
}
|
||||
|
||||
@ -72,7 +73,7 @@ public class Ice_Crystal extends Ability {
|
||||
loc.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, loc, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 48, 0, 0, 0, .2);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 2, 1);
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (data.getModifier("duration") * 20), (int) data.getModifier("amplifier")));
|
||||
cancel();
|
||||
return;
|
||||
|
@ -14,12 +14,12 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Item_Bomb extends Ability implements Listener {
|
||||
public Item_Bomb() {
|
||||
@ -35,7 +35,7 @@ public class Item_Bomb extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
ItemStack itemStack = stats.getPlayer().getInventory().getItemInMainHand().clone();
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR) {
|
||||
result.setSuccessful(false);
|
||||
@ -58,7 +58,7 @@ public class Item_Bomb extends Ability implements Listener {
|
||||
|
||||
for (Entity entity : item.getEntity().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).removePotionEffect(PotionEffectType.SLOW);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
|
@ -12,11 +12,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Item_Throw extends Ability implements Listener {
|
||||
public Item_Throw() {
|
||||
@ -30,7 +30,7 @@ public class Item_Throw extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
ItemStack itemStack = stats.getPlayer().getInventory().getItemInMainHand().clone();
|
||||
if (itemStack == null || itemStack.getType() == Material.AIR) {
|
||||
result.setSuccessful(false);
|
||||
@ -53,7 +53,7 @@ public class Item_Throw extends Ability implements Listener {
|
||||
item.getEntity().getWorld().spawnParticle(Particle.CRIT, item.getEntity().getLocation(), 0);
|
||||
for (Entity target : item.getEntity().getNearbyEntities(1, 1, 1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), target)) {
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) target);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Leap extends Ability {
|
||||
public Leap() {
|
||||
@ -23,7 +23,7 @@ public class Leap extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (!stats.getPlayer().isOnGround()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -11,11 +11,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Life_Ender extends Ability {
|
||||
public Life_Ender() {
|
||||
@ -30,7 +30,7 @@ public class Life_Ender extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double knockback = data.getModifier("knockback");
|
||||
double radius = data.getModifier("radius");
|
||||
@ -69,7 +69,7 @@ public class Life_Ender extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(source))
|
||||
if (entity.getLocation().distanceSquared(source) < radius * radius && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getLocation().subtract(source).toVector().setY(.75).normalize().multiply(knockback));
|
||||
}
|
||||
cancel();
|
||||
|
@ -12,11 +12,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Light_Dash extends Ability {
|
||||
public Light_Dash() {
|
||||
@ -30,7 +30,7 @@ public class Light_Dash extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double length = data.getModifier("length");
|
||||
|
||||
@ -49,7 +49,7 @@ public class Light_Dash extends Ability {
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(1, 1, 1))
|
||||
if (!hit.contains(entity.getEntityId()) && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 2);
|
||||
|
@ -8,11 +8,11 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Lightning_Beam extends Ability {
|
||||
public Lightning_Beam() {
|
||||
@ -26,7 +26,7 @@ public class Lightning_Beam extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -40,7 +40,7 @@ public class Lightning_Beam extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) <= radius * radius)
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 0);
|
||||
loc.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, loc, 64, 0, 0, 0, .2);
|
||||
|
@ -15,10 +15,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Magical_Path extends Ability {
|
||||
public Magical_Path() {
|
||||
@ -32,7 +32,7 @@ public class Magical_Path extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
stats.getPlayer().setAllowFlight(true);
|
||||
stats.getPlayer().setFlying(true);
|
||||
stats.getPlayer().setVelocity(stats.getPlayer().getVelocity().setY(.5));
|
||||
|
@ -11,10 +11,11 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Magical_Shield extends Ability {
|
||||
public static Map<Location, Double[]> magicalShield = new HashMap<>();
|
||||
@ -31,7 +32,7 @@ public class Magical_Shield extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (!stats.getPlayer().isOnGround()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -51,7 +52,7 @@ public class Magical_Shield extends Ability {
|
||||
ti++;
|
||||
for (double j = 0; j < Math.PI / 2; j += Math.PI / (28 + random.nextInt(5)))
|
||||
for (double i = 0; i < Math.PI * 2; i += Math.PI / (14 + random.nextInt(5)))
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(2.5 * Math.cos(i + j) * Math.sin(j), 2.5 * Math.cos(j), 2.5 * Math.sin(i + j) * Math.sin(j)), Color.FUCHSIA);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(2.5 * Math.cos(i + j) * Math.sin(j), 2.5 * Math.cos(j), 2.5 * Math.sin(i + j) * Math.sin(j)), Color.FUCHSIA);
|
||||
|
||||
if (ti > duration * 20 / 3) {
|
||||
magicalShield.remove(loc);
|
||||
|
@ -8,12 +8,14 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Magma_Fissure extends Ability {
|
||||
public Magma_Fissure() {
|
||||
@ -27,8 +29,8 @@ public class Magma_Fissure extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -56,7 +58,7 @@ public class Magma_Fissure extends Ability {
|
||||
if (target.getLocation().distanceSquared(loc) < 1) {
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + data.getModifier("ignite") * 20));
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Overload extends Ability {
|
||||
public Overload() {
|
||||
@ -28,7 +28,7 @@ public class Overload extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double radius = data.getModifier("radius");
|
||||
|
||||
@ -38,7 +38,7 @@ public class Overload extends Ability {
|
||||
|
||||
for (Entity entity : stats.getPlayer().getNearbyEntities(radius, radius, radius))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
|
||||
double step = 12 + (radius * 2.5);
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / step) {
|
||||
|
@ -19,13 +19,13 @@ import com.mojang.authlib.properties.Property;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Present_Throw extends Ability {
|
||||
private ItemStack present = VersionMaterial.PLAYER_HEAD.toItem();
|
||||
@ -57,7 +57,7 @@ public class Present_Throw extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double radiusSquared = Math.pow(data.getModifier("radius"), 2);
|
||||
|
||||
@ -89,7 +89,7 @@ public class Present_Throw extends Ability {
|
||||
item.getEntity().getWorld().playSound(item.getEntity().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 1.5f);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(item.getEntity().getLocation()))
|
||||
if (entity.getLocation().distanceSquared(item.getEntity().getLocation()) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
item.close();
|
||||
cancel();
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
@ -8,9 +9,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Regen_Ally extends Ability {
|
||||
public Regen_Ally() {
|
||||
@ -24,8 +26,8 @@ public class Regen_Ally extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null || !(target instanceof Player)) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -18,10 +18,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Shadow_Veil extends Ability implements Listener {
|
||||
public Shadow_Veil() {
|
||||
@ -36,7 +36,7 @@ public class Shadow_Veil extends Ability implements Listener {
|
||||
public static List<UUID> shadowVeil = new ArrayList<UUID>();
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration");
|
||||
|
||||
shadowVeil.add(stats.getPlayer().getUniqueId());
|
||||
|
@ -16,9 +16,10 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Shockwave extends Ability {
|
||||
public Shockwave() {
|
||||
@ -32,7 +33,7 @@ public class Shockwave extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double knockUp = data.getModifier("knock-up");
|
||||
double length = data.getModifier("length");
|
||||
|
||||
@ -50,7 +51,7 @@ public class Shockwave extends Ability {
|
||||
loc.add(vec);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_GRAVEL_BREAK, 1, 2);
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, loc, 12, .5, 0, .5, 0, Material.DIRT);
|
||||
|
||||
for (Entity ent : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (ent.getLocation().distance(loc) < 1.1 && ent instanceof LivingEntity && !ent.equals(stats.getPlayer()) && !hit.contains(ent.getEntityId())) {
|
||||
|
@ -18,11 +18,12 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class Shulker_Missile extends Ability implements Listener {
|
||||
public Shulker_Missile() {
|
||||
@ -37,7 +38,7 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration");
|
||||
|
||||
new BukkitRunnable() {
|
||||
@ -53,7 +54,7 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_WITHER_SHOOT, 2, 2);
|
||||
ShulkerBullet shulkerBullet = (ShulkerBullet) stats.getPlayer().getWorld().spawnEntity(stats.getPlayer().getLocation().add(0, 1, 0), EntityType.SHULKER_BULLET);
|
||||
shulkerBullet.setShooter(stats.getPlayer());
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE), data.getModifier("effect-duration"));
|
||||
MMOItems.plugin.getEntities().registerCustomEntity(shulkerBullet, new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE), data.getModifier("effect-duration"));
|
||||
new BukkitRunnable() {
|
||||
double ti = 0;
|
||||
|
||||
@ -83,7 +84,7 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
}
|
||||
|
||||
Object[] data = MMOItems.plugin.getEntities().getEntityData(damager);
|
||||
AttackResult result = (AttackResult) data[0];
|
||||
ItemAttackResult result = (ItemAttackResult) data[0];
|
||||
double duration = (double) data[1] * 20;
|
||||
|
||||
// void spirit
|
||||
@ -108,7 +109,7 @@ public class Shulker_Missile extends Ability implements Listener {
|
||||
y += .04;
|
||||
for (int j = 0; j < 2; j++) {
|
||||
double xz = y * Math.PI * 1.3 + (j * Math.PI);
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), Color.MAROON);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(xz), y, Math.sin(xz)), Color.MAROON);
|
||||
}
|
||||
}
|
||||
if (y >= 2)
|
||||
|
@ -10,10 +10,10 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Sky_Smash extends Ability {
|
||||
public Sky_Smash() {
|
||||
@ -27,7 +27,7 @@ public class Sky_Smash extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
double knockUp = data.getModifier("knock-up");
|
||||
|
||||
@ -39,7 +39,7 @@ public class Sky_Smash extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc) < 10) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
Location loc1 = stats.getPlayer().getEyeLocation().clone();
|
||||
loc1.setPitch(-70);
|
||||
((LivingEntity) entity).setVelocity(loc1.getDirection().multiply(1.2 * knockUp));
|
||||
|
@ -2,12 +2,13 @@ package net.Indyuce.mmoitems.ability;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Smite extends Ability {
|
||||
public Smite() {
|
||||
@ -20,14 +21,14 @@ public class Smite extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
}
|
||||
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
target.getWorld().strikeLightningEffect(target.getLocation());
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Snowman_Turret extends Ability {
|
||||
public Snowman_Turret() {
|
||||
@ -33,7 +33,7 @@ public class Snowman_Turret extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
|
@ -7,13 +7,14 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Sparkle extends Ability {
|
||||
public Sparkle() {
|
||||
@ -28,8 +29,8 @@ public class Sparkle extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -39,7 +40,7 @@ public class Sparkle extends Ability {
|
||||
double radius = data.getModifier("radius");
|
||||
double limit = data.getModifier("limit");
|
||||
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, target);
|
||||
target.getWorld().spawnParticle(Particle.EXPLOSION_LARGE, target.getLocation().add(0, 1, 0), 0);
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2);
|
||||
|
||||
@ -47,7 +48,7 @@ public class Sparkle extends Ability {
|
||||
for (Entity entity : target.getNearbyEntities(radius, radius, radius))
|
||||
if (count < limit && entity instanceof LivingEntity && entity != stats.getPlayer() && !(entity instanceof ArmorStand)) {
|
||||
count++;
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.getWorld().playSound(entity.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_TWINKLE.toSound(), 2, 2);
|
||||
Location loc_t = target.getLocation().add(0, .75, 0);
|
||||
Location loc_ent = entity.getLocation().add(0, .75, 0);
|
||||
|
@ -6,10 +6,10 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Swiftness extends Ability {
|
||||
public Swiftness() {
|
||||
@ -23,7 +23,7 @@ public class Swiftness extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration");
|
||||
int amplifier = (int) data.getModifier("amplifier");
|
||||
|
||||
|
@ -14,8 +14,8 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class TNT_Throw extends Ability implements Listener {
|
||||
@ -29,7 +29,7 @@ public class TNT_Throw extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Vector vec = getTargetDirection(stats.getPlayer(), target).multiply(2 * data.getModifier("force"));
|
||||
TNTPrimed tnt = (TNTPrimed) stats.getPlayer().getWorld().spawnEntity(stats.getPlayer().getLocation().add(0, 1, 0), EntityType.PRIMED_TNT);
|
||||
tnt.setFuseTicks(80);
|
||||
|
@ -14,10 +14,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Tactical_Grenade extends Ability {
|
||||
public Tactical_Grenade() {
|
||||
@ -32,8 +33,8 @@ public class Tactical_Grenade extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -73,7 +74,7 @@ public class Tactical_Grenade extends Ability {
|
||||
if (entity.equals(target))
|
||||
cancel();
|
||||
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.setVelocity(entity.getVelocity().add(offsetVector(knockup)));
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,14 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Targeted_Fireball extends Ability {
|
||||
public Targeted_Fireball() {
|
||||
@ -26,8 +28,8 @@ public class Targeted_Fireball extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -55,7 +57,7 @@ public class Targeted_Fireball extends Ability {
|
||||
loc.getWorld().spawnParticle(Particle.FLAME, loc, 32, 0, 0, 0, .1);
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_BLAZE_HURT, 2, 1);
|
||||
target.setFireTicks((int) (target.getFireTicks() + data.getModifier("ignite") * 20));
|
||||
new AttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, target);
|
||||
new ItemAttackResult(data.getModifier("damage"), DamageType.SKILL, DamageType.MAGICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, target);
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,13 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.api.util.NoInteractItemEntity;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.nms.ItemTag;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
public class Throw_Up extends Ability implements Listener {
|
||||
public Throw_Up() {
|
||||
@ -33,7 +34,7 @@ public class Throw_Up extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double duration = data.getModifier("duration") * 10;
|
||||
double dps = data.getModifier("damage") / 2;
|
||||
|
||||
@ -52,11 +53,11 @@ public class Throw_Up extends Ability implements Listener {
|
||||
if (j % 5 == 0)
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 40 && stats.getPlayer().getEyeLocation().getDirection().angle(entity.getLocation().toVector().subtract(stats.getPlayer().getLocation().toVector())) < Math.PI / 6 && MMOUtils.canDamage(stats.getPlayer(), entity))
|
||||
new AttackResult(dps, DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(dps, DamageType.SKILL, DamageType.PHYSICAL, DamageType.PROJECTILE).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.ENTITY_ZOMBIE_HURT, 1, 1);
|
||||
|
||||
NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), MMOItems.plugin.getNMS().getNBTItem(new ItemStack(Material.ROTTEN_FLESH)).addTag(new ItemTag("noStack", random.nextInt(1000))).toItem());
|
||||
NoInteractItemEntity item = new NoInteractItemEntity(stats.getPlayer().getLocation().add(0, 1.2, 0), MMOLib.plugin.getNMS().getNBTItem(new ItemStack(Material.ROTTEN_FLESH)).addTag(new ItemTag("noStack", random.nextInt(1000))).toItem());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(MMOItems.plugin, () -> item.close(), 40);
|
||||
item.getEntity().setVelocity(loc.getDirection().multiply(.8));
|
||||
stats.getPlayer().getWorld().spawnParticle(Particle.SMOKE_LARGE, stats.getPlayer().getLocation().add(0, 1.2, 0), 0, loc.getDirection().getX(), loc.getDirection().getY(), loc.getDirection().getZ(), 1);
|
||||
|
@ -11,10 +11,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Thrust extends Ability {
|
||||
public Thrust() {
|
||||
@ -27,7 +27,7 @@ public class Thrust extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
double damage = data.getModifier("damage");
|
||||
|
||||
stats.getPlayer().getWorld().playSound(stats.getPlayer().getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, 0);
|
||||
@ -39,7 +39,7 @@ public class Thrust extends Ability {
|
||||
loc.add(vec);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), loc, entity))
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.PHYSICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
loc.getWorld().spawnParticle(Particle.SMOKE_LARGE, loc, 0);
|
||||
}
|
||||
}
|
||||
|
@ -10,11 +10,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Arcane_Hail extends Ability {
|
||||
public Arcane_Hail() {
|
||||
@ -29,7 +29,7 @@ public class Arcane_Hail extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -54,7 +54,7 @@ public class Arcane_Hail extends Ability {
|
||||
loc1.getWorld().playSound(loc1, VersionSound.ENTITY_ENDERMAN_HURT.toSound(), 1, 0);
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc1))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && entity.getLocation().distanceSquared(loc1) <= 4)
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
loc1.getWorld().spawnParticle(Particle.SPELL_WITCH, loc1, 12, 0, 0, 0, .1);
|
||||
loc1.getWorld().spawnParticle(Particle.SMOKE_NORMAL, loc1, 6, 0, 0, 0, .1);
|
||||
|
||||
|
@ -15,11 +15,11 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Arcane_Rift extends Ability {
|
||||
public Arcane_Rift() {
|
||||
@ -35,7 +35,7 @@ public class Arcane_Rift extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (!stats.getPlayer().isOnGround()) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -62,7 +62,7 @@ public class Arcane_Rift extends Ability {
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (MMOUtils.canDamage(stats.getPlayer(), entity) && loc.distanceSquared(entity.getLocation()) < 2 && !hit.contains(entity.getEntityId())) {
|
||||
hit.add(entity.getEntityId());
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (slowDuration * 20), (int) slowAmplifier));
|
||||
}
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Blind extends Ability {
|
||||
public Blind() {
|
||||
@ -27,8 +27,8 @@ public class Blind extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -39,7 +39,7 @@ public class Blind extends Ability {
|
||||
for (double j = 0; j < 2; j++) {
|
||||
Location loc = target.getLocation();
|
||||
Vector vec = MMOUtils.rotateFunc(new Vector(Math.cos(i), 1 + Math.cos(i + (Math.PI * j)) * .5, Math.sin(i)), stats.getPlayer().getLocation());
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.add(vec), Color.BLACK);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.add(vec), Color.BLACK);
|
||||
}
|
||||
target.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, (int) (data.getModifier("duration") * 20), 0));
|
||||
}
|
||||
|
@ -4,11 +4,12 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Bloodbath extends Ability {
|
||||
public Bloodbath() {
|
||||
@ -21,8 +22,8 @@ public class Bloodbath extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -7,10 +7,12 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Burn extends Ability {
|
||||
public Burn() {
|
||||
@ -23,8 +25,8 @@ public class Burn extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -7,10 +7,12 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Confuse extends Ability {
|
||||
public Confuse() {
|
||||
@ -22,8 +24,8 @@ public class Confuse extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -10,8 +10,8 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public class Corrosion extends Ability {
|
||||
@ -27,7 +27,7 @@ public class Corrosion extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
|
@ -8,11 +8,13 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Death_Mark extends Ability {
|
||||
public Death_Mark() {
|
||||
@ -27,8 +29,8 @@ public class Death_Mark extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -50,7 +52,7 @@ public class Death_Mark extends Ability {
|
||||
target.getWorld().spawnParticle(Particle.SPELL_MOB, target.getLocation(), 4, .2, 0, .2, 0);
|
||||
|
||||
if (ti % 20 == 0)
|
||||
MMOItems.plugin.getDamage().damage(stats.getPlayer(), target, new AttackResult(dps, DamageType.SKILL, DamageType.MAGICAL).applySkillEffects(stats, target), false);
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, new ItemAttackResult(dps, DamageType.SKILL, DamageType.MAGICAL).applySkillEffects(stats, target), false);
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_BLAZE_HURT, 1, 2);
|
||||
|
@ -9,10 +9,10 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Freeze extends Ability {
|
||||
public Freeze() {
|
||||
@ -27,7 +27,7 @@ public class Freeze extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
|
@ -7,10 +7,10 @@ import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Ignite extends Ability {
|
||||
public Ignite() {
|
||||
@ -25,7 +25,7 @@ public class Ignite extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
|
@ -8,10 +8,10 @@ import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
|
||||
public class Minor_Explosion extends Ability {
|
||||
public Minor_Explosion() {
|
||||
@ -26,7 +26,7 @@ public class Minor_Explosion extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
Location loc = getTargetLocation(stats.getPlayer(), target);
|
||||
if (loc == null) {
|
||||
result.setSuccessful(false);
|
||||
@ -43,7 +43,7 @@ public class Minor_Explosion extends Ability {
|
||||
|
||||
for (Entity entity : MMOUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < radiusSquared && MMOUtils.canDamage(stats.getPlayer(), entity)) {
|
||||
new AttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
new ItemAttackResult(damage, DamageType.SKILL, DamageType.MAGICAL).applyEffectsAndDamage(stats, null, (LivingEntity) entity);
|
||||
entity.setVelocity(MMOUtils.normalize(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.2).multiply(2 * knockback));
|
||||
}
|
||||
}
|
||||
|
@ -6,11 +6,12 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Poison extends Ability {
|
||||
public Poison() {
|
||||
@ -24,8 +25,8 @@ public class Poison extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -7,11 +7,13 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Shock extends Ability {
|
||||
public Shock() {
|
||||
@ -24,8 +26,8 @@ public class Shock extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -10,10 +10,12 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Slow extends Ability {
|
||||
public Slow() {
|
||||
@ -27,8 +29,8 @@ public class Slow extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -45,7 +47,7 @@ public class Slow extends Ability {
|
||||
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI)
|
||||
for (double r = 0; r < .7; r += .1)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos((ti / 2) + j + (Math.PI * r)) * r * 2, .1, Math.sin((ti / 2) + j + (Math.PI * r)) * r * 2), Color.WHITE);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos((ti / 2) + j + (Math.PI * r)) * r * 2, .1, Math.sin((ti / 2) + j + (Math.PI * r)) * r * 2), Color.WHITE);
|
||||
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
|
@ -9,10 +9,10 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Starfall extends Ability {
|
||||
public Starfall() {
|
||||
@ -25,7 +25,7 @@ public class Starfall extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -6,11 +6,12 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Stun extends Ability {
|
||||
public Stun() {
|
||||
@ -23,8 +24,8 @@ public class Stun extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, AttackResult result) {
|
||||
target = target == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : target;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity target, AbilityData data, ItemAttackResult result) {
|
||||
target = target == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : target;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
|
@ -10,9 +10,10 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Vampirism extends Ability {
|
||||
public Vampirism() {
|
||||
@ -25,8 +26,8 @@ public class Vampirism extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -43,7 +44,7 @@ public class Vampirism extends Ability {
|
||||
dis += ti <= 10 ? .15 : -.15;
|
||||
|
||||
for (double j = 0; j < Math.PI * 2; j += Math.PI / 4)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(j + (ti / 20)) * dis, 0, Math.sin(j + (ti / 20)) * dis), Color.RED);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(j + (ti / 20)) * dis, 0, Math.sin(j + (ti / 20)) * dis), Color.RED);
|
||||
}
|
||||
if (ti >= 17)
|
||||
cancel();
|
||||
|
@ -20,11 +20,13 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public class Weaken_Target extends Ability implements Listener {
|
||||
public Map<UUID, WeakenedInfo> marked = new HashMap<>();
|
||||
@ -40,8 +42,8 @@ public class Weaken_Target extends Ability implements Listener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null || marked.containsKey(target.getUniqueId())) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -102,7 +104,7 @@ public class Weaken_Target extends Ability implements Listener {
|
||||
for (int j = 0; j < 3; j++) {
|
||||
y += .07;
|
||||
for (int k = 0; k < 3; k++)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5, y, Math.sin(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5), Color.BLACK);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5, y, Math.sin(y * Math.PI + (k * Math.PI * 2 / 3)) * (3 - y) / 2.5), Color.BLACK);
|
||||
}
|
||||
if (y > 3)
|
||||
cancel();
|
||||
|
@ -10,10 +10,12 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability;
|
||||
import net.Indyuce.mmoitems.api.ItemAttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Wither extends Ability {
|
||||
public Wither() {
|
||||
@ -27,8 +29,8 @@ public class Wither extends Ability {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, AttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOItems.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50).getHit() : initialTarget;
|
||||
public void whenCast(TemporaryStats stats, LivingEntity initialTarget, AbilityData data, ItemAttackResult result) {
|
||||
LivingEntity target = initialTarget == null ? MMOLib.plugin.getVersion().getWrapper().rayTrace(stats.getPlayer(), 50, entity -> MMOUtils.canDamage(stats.getPlayer(), entity)).getHit() : initialTarget;
|
||||
if (target == null) {
|
||||
result.setSuccessful(false);
|
||||
return;
|
||||
@ -48,7 +50,7 @@ public class Wither extends Ability {
|
||||
double a = y * Math.PI + (j * Math.PI * 2 / 3);
|
||||
double x = Math.cos(a) * (3 - y) / 2.5;
|
||||
double z = Math.sin(a) * (3 - y) / 2.5;
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(x, x, z), Color.BLACK);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(x, x, z), Color.BLACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.data.AbilityData;
|
||||
|
||||
public abstract class Ability {
|
||||
@ -100,7 +99,7 @@ public abstract class Ability {
|
||||
* these methods need to be overriden by ability classes depending on their
|
||||
* ability type
|
||||
*/
|
||||
public abstract void whenCast(TemporaryStats playerStats, LivingEntity target, AbilityData data, AttackResult result);
|
||||
public abstract void whenCast(TemporaryStats playerStats, LivingEntity target, AbilityData data, ItemAttackResult result);
|
||||
|
||||
/*
|
||||
* util methods for abilities
|
||||
|
@ -8,8 +8,8 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ArrowParticles extends BukkitRunnable {
|
||||
private Arrow arrow;
|
||||
@ -58,7 +58,7 @@ public class ArrowParticles extends BukkitRunnable {
|
||||
}
|
||||
|
||||
if (colored)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, 0, 1, color);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, 0, 1, color);
|
||||
else
|
||||
arrow.getWorld().spawnParticle(particle, arrow.getLocation().add(0, .25, 0), amount, offset, offset, offset, speed);
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.util.MushroomState;
|
||||
import net.Indyuce.mmoitems.manager.BlockManager;
|
||||
import net.Indyuce.mmoitems.version.nms.ItemTag;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
|
||||
public class CustomBlock {
|
||||
MushroomState state;
|
||||
@ -80,11 +81,11 @@ public class CustomBlock {
|
||||
meta.setUnbreakable(true);
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
|
||||
if(MMOItems.plugin.getVersion().isBelowOrEqual(1, 13)) ((Damageable) meta).setDamage(id);
|
||||
if(MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) ((Damageable) meta).setDamage(id);
|
||||
|
||||
item.setItemMeta(meta);
|
||||
|
||||
return MMOItems.plugin.getNMS().getNBTItem(item)
|
||||
return MMOLib.plugin.getNMS().getNBTItem(item)
|
||||
.addTag(new ItemTag("MMOITEMS_DISABLE_CRAFTING", true),
|
||||
new ItemTag("MMOITEMS_DISABLE_SMITHING", true),
|
||||
new ItemTag("MMOITEMS_DISABLE_ENCHANTING", true),
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.version.VersionMaterial;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public enum CustomSound {
|
||||
ON_ATTACK(Material.IRON_SWORD, 19, "Plays when attacking an entity."),
|
||||
|
@ -19,15 +19,15 @@ import org.bukkit.util.Vector;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult.DamageType;
|
||||
import net.Indyuce.mmoitems.listener.ElementListener;
|
||||
import net.Indyuce.mmoitems.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
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() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats 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);
|
||||
target.setFireTicks((int) (attack * 2));
|
||||
@ -36,7 +36,7 @@ public enum Element {
|
||||
}),
|
||||
|
||||
ICE(VersionMaterial.SNOWBALL.toMaterial(), "Ice", ChatColor.AQUA, new ElementParticle(Particle.BLOCK_CRACK, .07f, 16, Material.ICE), new ElementHandler() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
new BukkitRunnable() {
|
||||
double y = 0;
|
||||
Location loc = target.getLocation();
|
||||
@ -46,7 +46,7 @@ public enum Element {
|
||||
if ((y += .07) >= 3)
|
||||
cancel();
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI * 2 / 3)
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5, y / 1.1, Math.sin(y * Math.PI + k) * (3 - y) / 2.5), Color.WHITE);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.REDSTONE, loc.clone().add(Math.cos(y * Math.PI + k) * (3 - y) / 2.5, y / 1.1, Math.sin(y * Math.PI + k) * (3 - y) / 2.5), Color.WHITE);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(MMOItems.plugin, 0, 1);
|
||||
@ -57,7 +57,7 @@ public enum Element {
|
||||
}),
|
||||
|
||||
WIND(Material.FEATHER, "Wind", ChatColor.GRAY, new ElementParticle(Particle.EXPLOSION_NORMAL, .06f, 8), new ElementHandler() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats 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);
|
||||
target.setVelocity(vec);
|
||||
@ -73,9 +73,9 @@ public enum Element {
|
||||
}),
|
||||
|
||||
EARTH(VersionMaterial.OAK_SAPLING.toMaterial(), "Earth", ChatColor.GREEN, new ElementParticle(Particle.BLOCK_CRACK, .05f, 24, Material.DIRT), new ElementHandler() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
target.getWorld().playSound(target.getLocation(), Sound.BLOCK_GRASS_BREAK, 2, 0);
|
||||
MMOItems.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, target.getLocation().add(0, .1, 0), 64, 1, 0, 1, 0, Material.DIRT);
|
||||
MMOLib.plugin.getVersion().getWrapper().spawnParticle(Particle.BLOCK_CRACK, target.getLocation().add(0, .1, 0), 64, 1, 0, 1, 0, Material.DIRT);
|
||||
result.addDamage(absolute);
|
||||
|
||||
target.setVelocity(new Vector(0, 1, 0));
|
||||
@ -86,11 +86,11 @@ public enum Element {
|
||||
}),
|
||||
|
||||
THUNDER(VersionMaterial.GUNPOWDER.toMaterial(), "Thunder", ChatColor.YELLOW, new ElementParticle(Particle.FIREWORKS_SPARK, .05f, 8), new ElementHandler() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats 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 AttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats, (LivingEntity) entity);
|
||||
new ItemAttackResult(result.getDamage() * attack / 100, DamageType.WEAPON).damage(stats, (LivingEntity) entity);
|
||||
|
||||
result.addDamage(absolute);
|
||||
for (double k = 0; k < Math.PI * 2; k += Math.PI / 16)
|
||||
@ -99,7 +99,7 @@ public enum Element {
|
||||
}),
|
||||
|
||||
WATER(VersionMaterial.LILY_PAD.toMaterial(), "Water", ChatColor.BLUE, new ElementParticle(Particle.BLOCK_CRACK, .07f, 32, Material.WATER), new ElementHandler() {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
public void elementAttack(TemporaryStats stats, ItemAttackResult result, LivingEntity target, double attack, double absolute) {
|
||||
ElementListener.weaken(target);
|
||||
new BukkitRunnable() {
|
||||
double step = Math.PI / 2;
|
||||
@ -156,7 +156,7 @@ public enum Element {
|
||||
}
|
||||
|
||||
public interface ElementHandler {
|
||||
public void elementAttack(TemporaryStats stats, AttackResult result, LivingEntity target, double damage, double absolute);
|
||||
public void elementAttack(TemporaryStats stats, ItemAttackResult result, LivingEntity target, double damage, double absolute);
|
||||
}
|
||||
|
||||
public static class ElementParticle {
|
||||
@ -167,7 +167,7 @@ public enum Element {
|
||||
}
|
||||
|
||||
public ElementParticle(Particle particle, float speed, int amount, Material material) {
|
||||
display = (entity) -> MMOItems.plugin.getVersion().getWrapper().spawnParticle(particle, entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0, speed, material);
|
||||
display = (entity) -> MMOLib.plugin.getVersion().getWrapper().spawnParticle(particle, entity.getLocation().add(0, entity.getHeight() / 2, 0), amount, 0, 0, 0, speed, material);
|
||||
}
|
||||
|
||||
public void displayParticle(Entity entity) {
|
||||
|
@ -7,21 +7,20 @@ import java.util.Random;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ElementalAttack {
|
||||
private Map<Element, Double> relative = new HashMap<>();
|
||||
private Map<Element, Double> absolute = new HashMap<>();
|
||||
private AttackResult result;
|
||||
private ItemAttackResult result;
|
||||
private LivingEntity target;
|
||||
|
||||
private static final Random random = new Random();
|
||||
|
||||
public ElementalAttack(NBTItem item, AttackResult result) {
|
||||
public ElementalAttack(NBTItem item, ItemAttackResult result) {
|
||||
this.result = result;
|
||||
|
||||
for (Element element : Element.values()) {
|
||||
@ -40,7 +39,7 @@ public class ElementalAttack {
|
||||
this.target = target;
|
||||
|
||||
for (ItemStack equip : target.getEquipment().getArmorContents()) {
|
||||
NBTItem nbtEquip = MMOItems.plugin.getNMS().getNBTItem(equip);
|
||||
NBTItem nbtEquip = MMOLib.plugin.getNMS().getNBTItem(equip);
|
||||
if (nbtEquip.getType() != null)
|
||||
for (Element element : absolute.keySet()) {
|
||||
double defense = nbtEquip.getStat(element.name() + "_DEFENSE") / 100;
|
||||
|
127
src/main/java/net/Indyuce/mmoitems/api/ItemAttackResult.java
Normal file
127
src/main/java/net/Indyuce/mmoitems/api/ItemAttackResult.java
Normal file
@ -0,0 +1,127 @@
|
||||
package net.Indyuce.mmoitems.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Ability.CastingMode;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemAttackResult extends AttackResult {
|
||||
private static final Random random = new Random();
|
||||
|
||||
public ItemAttackResult(boolean successful, DamageType... types) {
|
||||
this(successful, 0, types);
|
||||
}
|
||||
|
||||
public ItemAttackResult(double damage, DamageType... types) {
|
||||
this(true, damage, types);
|
||||
}
|
||||
|
||||
public ItemAttackResult(boolean successful, double damage, DamageType... types) {
|
||||
this(successful, damage, Arrays.asList(types));
|
||||
}
|
||||
|
||||
public ItemAttackResult(boolean successful, double damage, List<DamageType> types) {
|
||||
super(successful, damage, types);
|
||||
}
|
||||
|
||||
public ItemAttackResult(ItemAttackResult result) {
|
||||
super(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemAttackResult clone() {
|
||||
return new ItemAttackResult(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemAttackResult setSuccessful(boolean successful) {
|
||||
return (ItemAttackResult) super.setSuccessful(successful);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemAttackResult multiplyDamage(double coef) {
|
||||
return (ItemAttackResult) super.multiplyDamage(coef);
|
||||
}
|
||||
|
||||
public void damage(TemporaryStats stats, LivingEntity target) {
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, this);
|
||||
}
|
||||
|
||||
public void applyEffectsAndDamage(TemporaryStats stats, NBTItem item, LivingEntity target) {
|
||||
MMOLib.plugin.getDamage().damage(stats.getPlayer(), target, applyEffects(stats, item, target));
|
||||
}
|
||||
|
||||
/*
|
||||
* this methods makes applying ALL effects including elemental damage easier
|
||||
* for untargeted weapons like staffs.
|
||||
*/
|
||||
public ItemAttackResult applyEffects(TemporaryStats stats, NBTItem item, LivingEntity target) {
|
||||
if (hasType(DamageType.WEAPON)) {
|
||||
applyElementalEffects(stats, item, target);
|
||||
applyOnHitEffects(stats, target);
|
||||
} else if (hasType(DamageType.SKILL))
|
||||
applySkillEffects(stats, target);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemAttackResult applySkillEffects(TemporaryStats stats, LivingEntity target) {
|
||||
|
||||
for (DamageType type : DamageType.values())
|
||||
if (hasType(type))
|
||||
addRelativeDamage(stats.getStat((ItemStat) type.getMMOItemsStat()) / 100);
|
||||
|
||||
addRelativeDamage(stats.getStat(target instanceof Player ? ItemStat.PVP_DAMAGE : ItemStat.PVE_DAMAGE) / 100);
|
||||
if (MMOUtils.isUndead(target))
|
||||
addRelativeDamage(stats.getStat(ItemStat.UNDEAD_DAMAGE) / 100);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemAttackResult applyElementalEffects(TemporaryStats stats, NBTItem item, LivingEntity target) {
|
||||
new ElementalAttack(item, this).applyElementalArmor(target).apply(stats);
|
||||
return this;
|
||||
}
|
||||
|
||||
/*
|
||||
* vanilla melee weapons have no NBTTitems so this method only provides for
|
||||
* non-weapon specific effects like critical strikes and extra stat damage
|
||||
*/
|
||||
public ItemAttackResult applyOnHitEffects(TemporaryStats stats, LivingEntity target) {
|
||||
|
||||
// abilities
|
||||
stats.getPlayerData().castAbilities(stats, target, this, CastingMode.ON_HIT);
|
||||
|
||||
// extra damage
|
||||
for (DamageType type : DamageType.values())
|
||||
if (hasType(type))
|
||||
addRelativeDamage(stats.getStat((ItemStat) type.getMMOItemsStat()) / 100);
|
||||
|
||||
addRelativeDamage(stats.getStat(target instanceof Player ? ItemStat.PVP_DAMAGE : ItemStat.PVE_DAMAGE) / 100);
|
||||
if (MMOUtils.isUndead(target))
|
||||
addRelativeDamage(stats.getStat(ItemStat.UNDEAD_DAMAGE) / 100);
|
||||
|
||||
// critical strikes
|
||||
if (random.nextDouble() <= stats.getStat(ItemStat.CRITICAL_STRIKE_CHANCE) / 100) {
|
||||
multiplyDamage(MMOItems.plugin.getConfig().getDouble("crit-coefficient") + stats.getStat(ItemStat.CRITICAL_STRIKE_POWER) / 100);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_PLAYER_ATTACK_CRIT, 1, 1);
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, target.getLocation().add(0, 1, 0), 16, 0, 0, 0, .1);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
package net.Indyuce.mmoitems.api;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ProjectileData {
|
||||
private final NBTItem sourceItem;
|
||||
|
@ -11,6 +11,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.item.plugin.identify.UnidentifiedItem;
|
||||
import net.Indyuce.mmoitems.manager.TypeManager;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class Type {
|
||||
|
||||
@ -224,12 +225,12 @@ public class Type {
|
||||
|
||||
String[] split = str.split("\\:");
|
||||
Material material = Material.valueOf(split[0]);
|
||||
return split.length > 1 ? MMOItems.plugin.getVersion().getWrapper().textureItem(material, Integer.parseInt(split[1])) : new ItemStack(material);
|
||||
return split.length > 1 ? MMOLib.plugin.getVersion().getWrapper().textureItem(material, Integer.parseInt(split[1])) : new ItemStack(material);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static Type get(ItemStack item) {
|
||||
return MMOItems.plugin.getNMS().getNBTItem(item).getType();
|
||||
return MMOLib.plugin.getNMS().getNBTItem(item).getType();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -15,9 +15,8 @@ import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.Weapon;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData.CooldownType;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerStats.TemporaryStats;
|
||||
import net.Indyuce.mmoitems.api.player.damage.AttackResult;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.version.VersionSound;
|
||||
import net.mmogroup.mmolib.version.VersionSound;
|
||||
|
||||
public enum TypeSet {
|
||||
|
||||
@ -117,18 +116,18 @@ public enum TypeSet {
|
||||
*/
|
||||
EXTRA;
|
||||
|
||||
private SetAttackHandler<TemporaryStats, LivingEntity, Weapon, AttackResult> attackHandler;
|
||||
private SetAttackHandler<TemporaryStats, LivingEntity, Weapon, ItemAttackResult> attackHandler;
|
||||
|
||||
private TypeSet() {
|
||||
this((playerStats, target, weapon, result) -> {
|
||||
});
|
||||
}
|
||||
|
||||
private TypeSet(SetAttackHandler<TemporaryStats, LivingEntity, Weapon, AttackResult> attackHandler) {
|
||||
private TypeSet(SetAttackHandler<TemporaryStats, LivingEntity, Weapon, ItemAttackResult> attackHandler) {
|
||||
this.attackHandler = attackHandler;
|
||||
}
|
||||
|
||||
public void applyAttackEffect(TemporaryStats playerStats, LivingEntity target, Weapon weapon, AttackResult result) {
|
||||
public void applyAttackEffect(TemporaryStats playerStats, LivingEntity target, Weapon weapon, ItemAttackResult result) {
|
||||
attackHandler.apply(playerStats, target, weapon, result);
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.crafting.ingredient.Ingredient;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class IngredientInventory {
|
||||
|
||||
@ -32,7 +33,7 @@ public class IngredientInventory {
|
||||
public IngredientInventory(Inventory inv) {
|
||||
loop: for (ItemStack item : inv.getContents())
|
||||
if (item != null && item.getType() != Material.AIR) {
|
||||
NBTItem nbt = MMOItems.plugin.getNMS().getNBTItem(item);
|
||||
NBTItem nbt = MMOLib.plugin.getNMS().getNBTItem(item);
|
||||
for (Ingredient ingredient : MMOItems.plugin.getCrafting().getIngredients())
|
||||
if (ingredient.isValid(nbt)) {
|
||||
addIngredient(nbt, ingredient);
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.plugin.NamedItemStack;
|
||||
import net.Indyuce.mmoitems.version.VersionMaterial;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class StationItemOptions {
|
||||
private final CraftingStation station;
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.Indyuce.mmoitems.api.crafting.IngredientInventory;
|
||||
import net.Indyuce.mmoitems.api.crafting.IngredientInventory.PlayerIngredient;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public abstract class Ingredient {
|
||||
private final String id;
|
||||
|
@ -8,11 +8,11 @@ import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.util.AltChar;
|
||||
import net.Indyuce.mmoitems.stat.Display_Name;
|
||||
import net.Indyuce.mmoitems.stat.MaterialStat.MaterialData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class MMOItemIngredient extends Ingredient {
|
||||
private Type type;
|
||||
|
@ -6,8 +6,8 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConditionalDisplay;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.util.AltChar;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class VanillaIngredient extends Ingredient {
|
||||
private Material material;
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.crafting.ConfigMMOItem;
|
||||
import net.Indyuce.mmoitems.api.crafting.CraftingStation;
|
||||
@ -20,6 +19,7 @@ import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.stat.Upgrade_Stat.UpgradeData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class UpgradingRecipe extends Recipe {
|
||||
private final ConfigMMOItem item;
|
||||
@ -62,7 +62,7 @@ public class UpgradingRecipe extends Recipe {
|
||||
}
|
||||
|
||||
UpgradingRecipeInfo recipe = (UpgradingRecipeInfo) uncastRecipe;
|
||||
if (!(recipe.mmoitem = new MMOItem(MMOItems.plugin.getNMS().getNBTItem(inv.getIngredient(ingredient).getFirstItem()))).hasData(ItemStat.UPGRADE))
|
||||
if (!(recipe.mmoitem = new MMOItem(MMOLib.plugin.getNMS().getNBTItem(inv.getIngredient(ingredient).getFirstItem()))).hasData(ItemStat.UPGRADE))
|
||||
return false;
|
||||
|
||||
if (!(recipe.upgradeData = (UpgradeData) recipe.getMMOItem().getData(ItemStat.UPGRADE)).canLevelUp()) {
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class DropItem {
|
||||
private final Type type;
|
||||
@ -94,7 +95,7 @@ public class DropItem {
|
||||
return null;
|
||||
|
||||
item.setAmount(amount);
|
||||
return isUnidentified() ? type.getUnidentifiedTemplate().newBuilder(MMOItems.plugin.getNMS().getNBTItem(item)).build() : item;
|
||||
return isUnidentified() ? type.getUnidentifiedTemplate().newBuilder(MMOLib.plugin.getNMS().getNBTItem(item)).build() : item;
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
|
@ -7,6 +7,7 @@ import net.Indyuce.mmoitems.api.edition.process.AnvilGUI;
|
||||
import net.Indyuce.mmoitems.api.edition.process.ChatEdition;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.Indyuce.mmoitems.gui.edition.BlockEdition.ConfigOptions;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class BlockChatEdition implements Edition {
|
||||
|
||||
@ -41,7 +42,7 @@ public class BlockChatEdition implements Edition {
|
||||
* anvil text input feature. enables players to use an anvil to input
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOItems.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
return;
|
||||
}
|
||||
@ -50,7 +51,7 @@ public class BlockChatEdition implements Edition {
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
MMOItems.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Block Edition", "See chat.", 10, 40, 10);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Block Edition", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.process.AnvilGUI;
|
||||
import net.Indyuce.mmoitems.api.edition.process.ChatEdition;
|
||||
import net.Indyuce.mmoitems.gui.ItemBrowser;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class NewItemEdition implements Edition {
|
||||
|
||||
@ -33,7 +34,7 @@ public class NewItemEdition implements Edition {
|
||||
* anvil text input feature. enables players to use an anvil to input
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOItems.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
return;
|
||||
}
|
||||
@ -42,7 +43,7 @@ public class NewItemEdition implements Edition {
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
MMOItems.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Creation", "See chat.", 10, 40, 10);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Creation", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import net.Indyuce.mmoitems.api.edition.process.AnvilGUI;
|
||||
import net.Indyuce.mmoitems.api.edition.process.ChatEdition;
|
||||
import net.Indyuce.mmoitems.gui.edition.EditionInventory;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class StatEdition implements Edition {
|
||||
|
||||
@ -45,7 +46,7 @@ public class StatEdition implements Edition {
|
||||
* anvil text input feature. enables players to use an anvil to input
|
||||
* text if they are having conflicts with their chat management plugins.
|
||||
*/
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOItems.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
if (MMOItems.plugin.getConfig().getBoolean("anvil-text-input") && MMOLib.plugin.getVersion().isBelowOrEqual(1, 13)) {
|
||||
new AnvilGUI(inv, this);
|
||||
return;
|
||||
}
|
||||
@ -54,7 +55,7 @@ public class StatEdition implements Edition {
|
||||
* default chat edition feature
|
||||
*/
|
||||
new ChatEdition(inv, this);
|
||||
MMOItems.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, 10);
|
||||
MMOLib.plugin.getNMS().sendTitle(inv.getPlayer(), ChatColor.GOLD + "" + ChatColor.BOLD + "Item Edition", "See chat.", 10, 40, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.edition.Edition;
|
||||
import net.Indyuce.mmoitems.gui.PluginInventory;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
|
||||
public class AnvilGUI extends EditionProcess implements Listener {
|
||||
private final int containerId;
|
||||
@ -28,21 +29,21 @@ public class AnvilGUI extends EditionProcess implements Listener {
|
||||
paperMeta.setDisplayName("Input text..");
|
||||
paper.setItemMeta(paperMeta);
|
||||
|
||||
MMOItems.plugin.getNMS().handleInventoryCloseEvent(getPlayer());
|
||||
MMOItems.plugin.getNMS().setActiveContainerDefault(getPlayer());
|
||||
MMOLib.plugin.getNMS().handleInventoryCloseEvent(getPlayer());
|
||||
MMOLib.plugin.getNMS().setActiveContainerDefault(getPlayer());
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOItems.plugin);
|
||||
|
||||
final Object container = MMOItems.plugin.getNMS().newContainerAnvil(getPlayer());
|
||||
final Object container = MMOLib.plugin.getNMS().newContainerAnvil(getPlayer());
|
||||
|
||||
inventory = MMOItems.plugin.getNMS().toBukkitInventory(container);
|
||||
inventory = MMOLib.plugin.getNMS().toBukkitInventory(container);
|
||||
inventory.setItem(0, paper);
|
||||
|
||||
containerId = MMOItems.plugin.getNMS().getNextContainerId(getPlayer());
|
||||
MMOItems.plugin.getNMS().sendPacketOpenWindow(getPlayer(), containerId);
|
||||
MMOItems.plugin.getNMS().setActiveContainer(getPlayer(), container);
|
||||
MMOItems.plugin.getNMS().setActiveContainerId(container, containerId);
|
||||
MMOItems.plugin.getNMS().addActiveContainerSlotListener(container, getPlayer());
|
||||
containerId = MMOLib.plugin.getNMS().getNextContainerId(getPlayer());
|
||||
MMOLib.plugin.getNMS().sendPacketOpenWindow(getPlayer(), containerId);
|
||||
MMOLib.plugin.getNMS().setActiveContainer(getPlayer(), container);
|
||||
MMOLib.plugin.getNMS().setActiveContainerId(container, containerId);
|
||||
MMOLib.plugin.getNMS().addActiveContainerSlotListener(container, getPlayer());
|
||||
|
||||
open = true;
|
||||
}
|
||||
@ -57,9 +58,9 @@ public class AnvilGUI extends EditionProcess implements Listener {
|
||||
return;
|
||||
open = false;
|
||||
|
||||
MMOItems.plugin.getNMS().handleInventoryCloseEvent(getPlayer());
|
||||
MMOItems.plugin.getNMS().setActiveContainerDefault(getPlayer());
|
||||
MMOItems.plugin.getNMS().sendPacketCloseWindow(getPlayer(), containerId);
|
||||
MMOLib.plugin.getNMS().handleInventoryCloseEvent(getPlayer());
|
||||
MMOLib.plugin.getNMS().setActiveContainerDefault(getPlayer());
|
||||
MMOLib.plugin.getNMS().sendPacketCloseWindow(getPlayer(), containerId);
|
||||
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemBreakEvent extends PlayerEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
@ -5,7 +5,7 @@ import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class ItemLoseDurabilityEvent extends PlayerEvent implements Cancellable {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
@ -15,7 +15,6 @@ import net.Indyuce.mmoitems.api.ItemTier;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.interaction.util.DurabilityItem;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.item.plugin.identify.IdentifiedItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.comp.flags.FlagPlugin.CustomFlag;
|
||||
@ -23,6 +22,8 @@ import net.Indyuce.mmoitems.stat.Soulbound.SoulboundData;
|
||||
import net.Indyuce.mmoitems.stat.Upgrade_Stat.UpgradeData;
|
||||
import net.Indyuce.mmoitems.stat.data.EffectListData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class Consumable extends UseItem {
|
||||
public Consumable(Player player, NBTItem item, Type type) {
|
||||
@ -203,8 +204,8 @@ public class Consumable extends UseItem {
|
||||
}
|
||||
|
||||
// vanilla durability
|
||||
if (!target.getBoolean("Unbreakable") && MMOItems.plugin.getVersion().getWrapper().isDamaged(target.getItem(), target.getItem().getItemMeta())) {
|
||||
MMOItems.plugin.getVersion().getWrapper().repair(target.getItem(), repairPower);
|
||||
if (!target.getBoolean("Unbreakable") && MMOLib.plugin.getVersion().getWrapper().isDamaged(target.getItem(), target.getItem().getItemMeta())) {
|
||||
MMOLib.plugin.getVersion().getWrapper().repair(target.getItem(), repairPower);
|
||||
Message.REPAIRED_ITEM.format(ChatColor.YELLOW, "#item#", MMOUtils.getDisplayName(target.getItem()), "#amount#", "" + repairPower).send(player);
|
||||
return true;
|
||||
}
|
||||
|
@ -9,12 +9,12 @@ import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.stat.data.GemSocketsData;
|
||||
import net.Indyuce.mmoitems.stat.data.GemSocketsData.GemstoneData;
|
||||
import net.Indyuce.mmoitems.stat.data.Mergeable;
|
||||
import net.Indyuce.mmoitems.stat.type.DoubleStat.DoubleData;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
|
||||
public class GemStone extends UseItem {
|
||||
|
@ -11,13 +11,13 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.MMOUtils;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.util.message.Message;
|
||||
import net.Indyuce.mmoitems.stat.Skull_Texture.SkullTextureData;
|
||||
import net.Indyuce.mmoitems.stat.data.StringListData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.Indyuce.mmoitems.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.version.nms.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.ItemTag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
|
||||
public class ItemSkin extends UseItem {
|
||||
public ItemSkin(Player player, NBTItem item, Type type) {
|
||||
|
@ -12,8 +12,8 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.comp.flags.FlagPlugin.CustomFlag;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class Tool extends UseItem {
|
||||
public Tool(Player player, NBTItem item, Type type) {
|
||||
|
@ -16,12 +16,12 @@ import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.Musket;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.Staff;
|
||||
import net.Indyuce.mmoitems.api.interaction.weapon.untargeted.Whip;
|
||||
import net.Indyuce.mmoitems.api.item.MMOItem;
|
||||
import net.Indyuce.mmoitems.api.item.NBTItem;
|
||||
import net.Indyuce.mmoitems.api.player.PlayerData;
|
||||
import net.Indyuce.mmoitems.comp.flags.FlagPlugin.CustomFlag;
|
||||
import net.Indyuce.mmoitems.stat.Commands.CommandListData;
|
||||
import net.Indyuce.mmoitems.stat.Commands.CommandListData.CommandData;
|
||||
import net.Indyuce.mmoitems.stat.type.ItemStat;
|
||||
import net.mmogroup.mmolib.api.item.NBTItem;
|
||||
|
||||
public class UseItem {
|
||||
protected final Player player;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user