forked from Upstream/mmocore
Nullable casting particles
This commit is contained in:
parent
817d28c602
commit
fa953f890f
@ -25,6 +25,7 @@ import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.experience.EXPSource;
|
||||
import net.Indyuce.mmocore.experience.ExpCurve;
|
||||
import net.Indyuce.mmocore.experience.ExperienceObject;
|
||||
import net.Indyuce.mmocore.experience.droptable.ExperienceTable;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.CastingParticle;
|
||||
import net.Indyuce.mmocore.player.stats.StatInfo;
|
||||
@ -32,7 +33,6 @@ import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.skill.cast.KeyCombo;
|
||||
import net.Indyuce.mmocore.skill.cast.PlayerKey;
|
||||
import net.Indyuce.mmocore.experience.ExperienceObject;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Location;
|
||||
@ -65,7 +65,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
@Nullable
|
||||
private final ExperienceTable expTable;
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
private final CastingParticle castParticle;
|
||||
|
||||
private final int maxBoundActiveSkills, maxBoundPassiveSkills;
|
||||
@ -193,9 +193,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
+ id + "': " + exception.getMessage());
|
||||
}
|
||||
|
||||
castParticle = config.contains("cast-particle")
|
||||
? new CastingParticle(config.getConfigurationSection("cast-particle"))
|
||||
: new CastingParticle(Particle.SPELL_INSTANT);
|
||||
castParticle = config.contains("cast-particle") ? new CastingParticle(config.getConfigurationSection("cast-particle")) : null;
|
||||
|
||||
if (config.contains("options"))
|
||||
for (String key : config.getConfigurationSection("options").getKeys(false))
|
||||
@ -337,6 +335,7 @@ public class PlayerClass extends PostLoadObject implements ExperienceObject {
|
||||
return icon.clone();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CastingParticle getCastParticle() {
|
||||
return castParticle;
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public abstract class SkillCastingHandler extends BukkitRunnable implements List
|
||||
private final PlayerData caster;
|
||||
|
||||
private boolean open = true;
|
||||
private int j;
|
||||
|
||||
public SkillCastingHandler(PlayerData caster, int runnablePeriod) {
|
||||
this.caster = caster;
|
||||
@ -40,8 +41,19 @@ public abstract class SkillCastingHandler extends BukkitRunnable implements List
|
||||
public void run() {
|
||||
if (!caster.isOnline() || caster.getPlayer().isDead())
|
||||
caster.leaveCastingMode();
|
||||
else
|
||||
else {
|
||||
|
||||
// Apply casting particles
|
||||
if (caster.getProfess().getCastParticle() != null)
|
||||
for (int k = 0; k < 2; k++) {
|
||||
double a = (double) j++ / 5;
|
||||
caster.getProfess().getCastParticle()
|
||||
.display(caster.getPlayer().getLocation().add(Math.cos(a), 1 + Math.sin(a / 3) / 1.3, Math.sin(a)));
|
||||
}
|
||||
|
||||
// Apply casting mode-specific effects
|
||||
onTick();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onTick();
|
||||
|
@ -8,6 +8,7 @@ import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.event.PlayerKeyPressEvent;
|
||||
import net.Indyuce.mmocore.api.SoundEvent;
|
||||
import net.Indyuce.mmocore.loot.chest.particle.CastingParticle;
|
||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||
import net.Indyuce.mmocore.skill.cast.PlayerKey;
|
||||
@ -137,13 +138,7 @@ public class SkillBar implements Listener {
|
||||
|
||||
@Override
|
||||
public void onTick() {
|
||||
if (j % 20 == 0) getCaster().displayActionBar(getFormat(getCaster()));
|
||||
|
||||
for (int k = 0; k < 2; k++) {
|
||||
double a = (double) j++ / 5;
|
||||
getCaster().getProfess().getCastParticle()
|
||||
.display(getCaster().getPlayer().getLocation().add(Math.cos(a), 1 + Math.sin(a / 3) / 1.3, Math.sin(a)));
|
||||
}
|
||||
if (j++ % 20 == 0) getCaster().displayActionBar(getFormat(getCaster()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user