mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-12-03 01:43:24 +01:00
!Update classes utilizing PlayerAttackEvent
This commit is contained in:
parent
07b7ca7786
commit
44b7676f17
@ -1,31 +0,0 @@
|
||||
package net.Indyuce.mmocore.api.event;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityEvent;
|
||||
|
||||
public class EntityKillEntityEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final Entity target;
|
||||
|
||||
public EntityKillEntityEvent(Entity what, Entity target) {
|
||||
super(what);
|
||||
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public Entity getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
@ -8,12 +8,12 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.event.EntityKillEntityEvent;
|
||||
import net.Indyuce.mmocore.api.experience.Profession;
|
||||
import net.Indyuce.mmocore.api.experience.source.type.SpecificExperienceSource;
|
||||
import net.Indyuce.mmocore.api.load.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.manager.profession.ExperienceManager;
|
||||
import net.mmogroup.mmolib.api.event.EntityKillEntityEvent;
|
||||
|
||||
public class KillMobExperienceSource extends SpecificExperienceSource<Entity> {
|
||||
public final EntityType type;
|
||||
|
@ -21,7 +21,7 @@ public class AttackEventTrigger implements EventTriggerHandler {
|
||||
PlayerData player = event.getData().getMMOCore();
|
||||
PlayerClass profess = player.getProfess();
|
||||
|
||||
for (DamageType type : event.getAttackInfo().getTypes()) {
|
||||
for (DamageType type : event.getAttack().getTypes()) {
|
||||
String path = type.getPath() + "-damage";
|
||||
if (profess.hasEventTriggers(path))
|
||||
profess.getEventTriggers(path).getTriggers().forEach(trigger -> trigger.apply(player));
|
||||
|
@ -32,6 +32,8 @@ public enum StatType {
|
||||
|
||||
CRITICAL_STRIKE_CHANCE,
|
||||
CRITICAL_STRIKE_POWER,
|
||||
SPELL_CRITICAL_STRIKE_CHANCE,
|
||||
SPELL_CRITICAL_STRIKE_POWER,
|
||||
|
||||
BLOCK_POWER,
|
||||
BLOCK_RATING,
|
||||
|
@ -5,10 +5,10 @@ import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import net.Indyuce.mmocore.api.event.EntityKillEntityEvent;
|
||||
import net.Indyuce.mmocore.api.load.MMOLineConfig;
|
||||
import net.Indyuce.mmocore.api.quest.ObjectiveProgress;
|
||||
import net.Indyuce.mmocore.api.quest.QuestProgress;
|
||||
import net.mmogroup.mmolib.api.event.EntityKillEntityEvent;
|
||||
|
||||
public class KillMobObjective extends Objective {
|
||||
private final EntityType type;
|
||||
|
@ -100,7 +100,7 @@ public class Empowered_Attack extends Skill {
|
||||
target.getWorld().playSound(target.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, .5f);
|
||||
target.getWorld().spawnParticle(Particle.FIREWORKS_SPARK, target.getLocation().add(0, target.getHeight() / 2, 0), 32, 0, 0, 0, .2);
|
||||
|
||||
double sweep = event.getDamage() * r;
|
||||
double sweep = event.getAttack().getDamage() * r;
|
||||
Location src = target.getLocation().add(0, target.getHeight() / 2, 0);
|
||||
|
||||
for (Entity entity : target.getNearbyEntities(rad, rad, rad))
|
||||
@ -113,7 +113,7 @@ public class Empowered_Attack extends Skill {
|
||||
* apply damage afterwards otherwise the damage dealt to nearby
|
||||
* entities scale with the extra ability damage.
|
||||
*/
|
||||
event.setDamage(event.getDamage() * c);
|
||||
event.getAttack().multiplyDamage(1 + c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class Evade extends Skill {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void b(PlayerAttackEvent event) {
|
||||
if (event.isWeapon() && !event.isCancelled() && event.getData().equals(data))
|
||||
if (event.isWeapon() && !event.isCancelled() && event.getData().getMMOCore().equals(data))
|
||||
close();
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,6 @@ public class Fire_Berserker extends Skill implements Listener {
|
||||
public void a(PlayerAttackEvent event) {
|
||||
PlayerData data = event.getData().getMMOCore();
|
||||
if (event.getPlayer().getFireTicks() > 0 && data.hasSkillUnlocked(this))
|
||||
event.setDamage(event.getDamage() * (1 + data.getProfess().getSkill(this).getModifier("extra", data.getSkillLevel(this))));
|
||||
event.getAttack().multiplyDamage(1 + data.getProfess().getSkill(this).getModifier("extra", data.getSkillLevel(this)));
|
||||
}
|
||||
}
|
||||
|
@ -88,8 +88,8 @@ public class Power_Mark extends Skill implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void stackDamage(PlayerAttackEvent event) {
|
||||
if (!event.isCancelled() && j < 20 * (duration - 2) && radiusCheck(event.getEntity().getLocation()) && event.getData().equals(data)) {
|
||||
accumulate += event.getDamage() * ratio;
|
||||
if (!event.isCancelled() && j < 20 * (duration - 2) && radiusCheck(event.getEntity().getLocation()) && event.getData().getMMOCore().equals(data)) {
|
||||
accumulate += event.getAttack().getDamage() * ratio;
|
||||
new ParabolicProjectile(event.getEntity().getLocation().add(0, event.getEntity().getHeight() / 2, 0), loc, () -> loc.getWorld().playSound(loc, Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1), Color.PURPLE);
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Sneaky_Picky extends Skill {
|
||||
|
||||
data.cast(cast.getInfo());
|
||||
|
||||
event.setDamage((1 + cast.getModifier("extra") / 100) * event.getDamage());
|
||||
event.getAttack().multiplyDamage(1 + cast.getModifier("extra") / 100);
|
||||
LivingEntity target = (LivingEntity) event.getEntity();
|
||||
target.getWorld().spawnParticle(Particle.SMOKE_NORMAL, target.getLocation().add(0, target.getHeight() / 2, 0), 64, 0, 0, 0, .05);
|
||||
target.getWorld().playSound(target.getLocation(), Sound.ENTITY_ZOMBIE_ATTACK_IRON_DOOR, 1, 2);
|
||||
|
Loading…
Reference in New Issue
Block a user