forked from Upstream/mmocore
!Fixed an issue with passive skills, removed unused libs
This commit is contained in:
parent
f526dff073
commit
1cb8f01a07
BIN
lib/MMOLib.jar
BIN
lib/MMOLib.jar
Binary file not shown.
@ -43,8 +43,6 @@ import net.Indyuce.mmocore.comp.mythicmobs.MythicMobsMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.placeholder.DefaultParser;
|
||||
import net.Indyuce.mmocore.comp.placeholder.PlaceholderAPIParser;
|
||||
import net.Indyuce.mmocore.comp.placeholder.PlaceholderParser;
|
||||
import net.Indyuce.mmocore.comp.rpg.DefaultRPGUtilHandler;
|
||||
import net.Indyuce.mmocore.comp.rpg.RPGUtilHandler;
|
||||
import net.Indyuce.mmocore.comp.vault.VaultEconomy;
|
||||
import net.Indyuce.mmocore.comp.vault.VaultMMOLoader;
|
||||
import net.Indyuce.mmocore.comp.worldguard.DefaultRegionHandler;
|
||||
@ -132,7 +130,6 @@ public class MMOCore extends JavaPlugin {
|
||||
public final SmithingManager smithingManager = new SmithingManager();
|
||||
|
||||
public final MMOLoadManager loadManager = new MMOLoadManager();
|
||||
public RPGUtilHandler rpgUtilHandler = new DefaultRPGUtilHandler();
|
||||
|
||||
|
||||
public void onLoad() {
|
||||
|
@ -666,9 +666,6 @@ public class PlayerData extends OfflinePlayerData {
|
||||
|
||||
public SkillResult cast(SkillInfo skill) {
|
||||
|
||||
if (skill.getSkill().isPassive())
|
||||
return new SkillResult(this, skill, CancelReason.OTHER);
|
||||
|
||||
PlayerCastSkillEvent event = new PlayerCastSkillEvent(this, skill);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled())
|
||||
@ -676,12 +673,13 @@ public class PlayerData extends OfflinePlayerData {
|
||||
|
||||
SkillResult cast = skill.getSkill().whenCast(this, skill);
|
||||
if (!cast.isSuccessful()) {
|
||||
if (!skill.getSkill().isPassive()) {
|
||||
if (cast.getCancelReason() == CancelReason.MANA)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("casting.no-mana").send(player);
|
||||
|
||||
if (cast.getCancelReason() == CancelReason.MANA)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("casting.no-mana").send(player);
|
||||
|
||||
if (cast.getCancelReason() == CancelReason.COOLDOWN)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(player);
|
||||
if (cast.getCancelReason() == CancelReason.COOLDOWN)
|
||||
MMOCore.plugin.configManager.getSimpleMessage("casting.on-cooldown").send(player);
|
||||
}
|
||||
|
||||
return cast;
|
||||
}
|
||||
|
@ -1,15 +1,6 @@
|
||||
package net.Indyuce.mmocore.api.player.stats;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.player.MMOData;
|
||||
import net.mmogroup.mmolib.api.stat.StatInstance;
|
||||
import net.mmogroup.mmolib.api.stat.StatMap;
|
||||
@ -60,36 +51,4 @@ public class PlayerStats {
|
||||
public double getExtraStat(StatType stat) {
|
||||
return getInstance(stat).getTotal(0);
|
||||
}
|
||||
|
||||
public CachedStats cache() {
|
||||
return new CachedStats();
|
||||
}
|
||||
|
||||
public class CachedStats {
|
||||
private final Player player;
|
||||
|
||||
private final Map<String, Double> stats = new HashMap<>();
|
||||
|
||||
public CachedStats() {
|
||||
this.player = data.getPlayer();
|
||||
for (StatType stat : StatType.values())
|
||||
this.stats.put(stat.name(), getStat(stat));
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
public PlayerData getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public double getStat(StatType stat) {
|
||||
return stats.get(stat.name());
|
||||
}
|
||||
|
||||
public void damage(LivingEntity target, double value, DamageType... types) {
|
||||
MMOLib.plugin.getDamage().damage(data.getPlayer(), target, new AttackResult(true, value, types));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.skill.SkillResult.CancelReason;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.IntegerLinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
@ -131,9 +130,7 @@ public abstract class Skill {
|
||||
* not overriden for passive skills therefore not abstract.
|
||||
*/
|
||||
public SkillResult whenCast(PlayerData data, SkillInfo skill) {
|
||||
SkillResult cast = new SkillResult(data, skill);
|
||||
cast.abort(CancelReason.OTHER);
|
||||
return cast;
|
||||
return new SkillResult(data, skill);
|
||||
}
|
||||
|
||||
public SkillInfo newSkillInfo(ConfigurationSection config) {
|
||||
|
@ -1,12 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.rpg;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.PlayerStats.CachedStats;
|
||||
|
||||
public class DefaultRPGUtilHandler implements RPGUtilHandler {
|
||||
|
||||
@Override
|
||||
public CachedStats cachePlayerStats(PlayerData playerData) {
|
||||
return playerData.getStats().cache();
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package net.Indyuce.mmocore.comp.rpg;
|
||||
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.PlayerStats.CachedStats;
|
||||
|
||||
public interface RPGUtilHandler {
|
||||
public CachedStats cachePlayerStats(PlayerData playerData);
|
||||
}
|
@ -17,12 +17,13 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import net.Indyuce.mmocore.MMOCore;
|
||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||
import net.Indyuce.mmocore.api.player.stats.PlayerStats.CachedStats;
|
||||
import net.Indyuce.mmocore.api.skill.Skill;
|
||||
import net.Indyuce.mmocore.api.skill.SkillResult;
|
||||
import net.Indyuce.mmocore.api.util.MMOCoreUtils;
|
||||
import net.Indyuce.mmocore.api.util.math.formula.LinearValue;
|
||||
import net.Indyuce.mmocore.api.util.math.particle.ParabolicProjectile;
|
||||
import net.mmogroup.mmolib.MMOLib;
|
||||
import net.mmogroup.mmolib.api.AttackResult;
|
||||
import net.mmogroup.mmolib.api.DamageType;
|
||||
import net.mmogroup.mmolib.api.event.PlayerAttackEvent;
|
||||
import net.mmogroup.mmolib.version.VersionMaterial;
|
||||
@ -59,7 +60,6 @@ public class Power_Mark extends Skill implements Listener {
|
||||
public class PowerMark extends BukkitRunnable implements Listener {
|
||||
private final PlayerData data;
|
||||
private final Location loc;
|
||||
private final CachedStats stats;
|
||||
|
||||
private double duration, ratio, stun;
|
||||
|
||||
@ -69,7 +69,6 @@ public class Power_Mark extends Skill implements Listener {
|
||||
public PowerMark(PlayerData data, SkillResult cast, Location loc) {
|
||||
this.data = data;
|
||||
this.loc = loc;
|
||||
this.stats = MMOCore.plugin.rpgUtilHandler.cachePlayerStats(data);
|
||||
|
||||
loc.getWorld().playSound(loc, Sound.BLOCK_END_PORTAL_FRAME_FILL, 2, 1);
|
||||
|
||||
@ -81,7 +80,7 @@ public class Power_Mark extends Skill implements Listener {
|
||||
Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
private void unregister() {
|
||||
PlayerAttackEvent.getHandlerList().unregister(this);
|
||||
cancel();
|
||||
}
|
||||
@ -115,9 +114,9 @@ public class Power_Mark extends Skill implements Listener {
|
||||
|
||||
for (Entity entity : MMOCoreUtils.getNearbyChunkEntities(loc))
|
||||
if (entity.getLocation().distanceSquared(loc) < 25 && MMOCoreUtils.canTarget(data.getPlayer(), entity)) {
|
||||
entity.setVelocity(format(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.3));
|
||||
((LivingEntity) entity).addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (stun * 20), 10, false, false));
|
||||
stats.damage((LivingEntity) entity, accumulate, DamageType.SKILL, DamageType.MAGIC);
|
||||
MMOLib.plugin.getDamage().damage(data.getPlayer(), (LivingEntity) entity, new AttackResult(accumulate, DamageType.SKILL, DamageType.MAGIC));
|
||||
entity.setVelocity(format(entity.getLocation().subtract(loc).toVector().setY(0)).setY(.3));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user