Lots and LOTS of isOnline checks

This commit is contained in:
ASangarin 2020-10-06 03:04:51 +02:00
parent e85003bc31
commit 938632e81a
48 changed files with 120 additions and 52 deletions

View File

@ -6,6 +6,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.droptable.DropTable; import net.Indyuce.mmocore.api.droptable.DropTable;
import net.Indyuce.mmocore.api.droptable.condition.ConditionInstance; import net.Indyuce.mmocore.api.droptable.condition.ConditionInstance;
import net.Indyuce.mmocore.api.loot.LootBuilder; import net.Indyuce.mmocore.api.loot.LootBuilder;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.mmogroup.mmolib.api.MMOLineConfig; import net.mmogroup.mmolib.api.MMOLineConfig;
public class DropTableDropItem extends DropItem { public class DropTableDropItem extends DropItem {
@ -23,7 +24,9 @@ public class DropTableDropItem extends DropItem {
@Override @Override
public void collect(LootBuilder builder) { public void collect(LootBuilder builder) {
if (dropTable.areConditionsMet(new ConditionInstance(builder.getEntity().getPlayer()))) PlayerData data = builder.getEntity();
if(!data.isOnline()) return;
if (dropTable.areConditionsMet(new ConditionInstance(data.getPlayer())))
for (int j = 0; j < rollAmount(); j++) for (int j = 0; j < rollAmount(); j++)
builder.addLoot(dropTable.collect(builder)); builder.addLoot(dropTable.collect(builder));
} }

View File

@ -29,7 +29,8 @@ public class CustomBlockMineEvent extends PlayerDataEvent implements Cancellable
this.block = block; this.block = block;
this.info = info; this.info = info;
this.drops = (info.hasDropTable() && info.getDropTable().areConditionsMet(new ConditionInstance(player.getPlayer()))) this.drops = (info.hasDropTable() && player.isOnline()
&& info.getDropTable().areConditionsMet(new ConditionInstance(player.getPlayer())))
? info.collectDrops(new LootBuilder(player, 0)) : new ArrayList<>(); ? info.collectDrops(new LootBuilder(player, 0)) : new ArrayList<>();
this.experience = info.hasExperience() ? info.getExperience().newInfo() : null; this.experience = info.hasExperience() ? info.getExperience().newInfo() : null;
} }

View File

@ -127,7 +127,7 @@ public class PlayerProfessions {
value = MMOCore.plugin.boosterManager.calculateExp(profession, value); value = MMOCore.plugin.boosterManager.calculateExp(profession, value);
// display hologram // display hologram
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms")) if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && playerData.isOnline())
if (loc != null && MMOCore.plugin.hologramSupport != null) if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), playerData.getPlayer());
@ -158,7 +158,7 @@ public class PlayerProfessions {
playerData.giveExperience((int) profession.getExperience().calculate(level), null); playerData.giveExperience((int) profession.getExperience().calculate(level), null);
} }
if (check) { if (check && playerData.isOnline()) {
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(playerData, profession, oldLevel, level)); Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(playerData, profession, oldLevel, level));
new SmallParticleEffect(playerData.getPlayer(), Particle.SPELL_INSTANT); new SmallParticleEffect(playerData.getPlayer(), Particle.SPELL_INSTANT);
new ConfigMessage("profession-level-up").addPlaceholders("level", "" + level, "profession", profession.getName()) new ConfigMessage("profession-level-up").addPlaceholders("level", "" + level, "profession", profession.getName())
@ -171,6 +171,7 @@ public class PlayerProfessions {
int chars = (int) ((double) exp / needed * 20); int chars = (int) ((double) exp / needed * 20);
for (int j = 0; j < 20; j++) for (int j = 0; j < 20; j++)
bar += (j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "") + "|"; bar += (j == chars ? "" + ChatColor.WHITE + ChatColor.BOLD : "") + "|";
if(playerData.isOnline())
MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getName(), "progress", bar, "ratio", MMOCore.plugin.configManager.getSimpleMessage("exp-notification", "profession", profession.getName(), "progress", bar, "ratio",
MMOCore.plugin.configManager.decimal.format((double) exp / needed * 100)).send(playerData.getPlayer()); MMOCore.plugin.configManager.decimal.format((double) exp / needed * 100)).send(playerData.getPlayer());
} }

View File

@ -58,6 +58,7 @@ public class BrewPotionExperienceSource extends ExperienceSource<PotionMeta> {
return; return;
PlayerData data = PlayerData.get(playerOpt.get()); PlayerData data = PlayerData.get(playerOpt.get());
if(!data.isOnline()) return;
for (BrewPotionExperienceSource source : getSources()) for (BrewPotionExperienceSource source : getSources())
if (source.matches(data, (PotionMeta) brewn.getItemMeta())) if (source.matches(data, (PotionMeta) brewn.getItemMeta()))
new PotionUpgrade(found, brewn).process(data.getPlayer()); new PotionUpgrade(found, brewn).process(data.getPlayer());

View File

@ -48,8 +48,12 @@ public abstract class ExperienceSource<T> {
public void giveExperience(PlayerData player, int amount, Location location) { public void giveExperience(PlayerData player, int amount, Location location) {
if (hasProfession()) if (hasProfession())
player.getCollectionSkills().giveExperience(profession, amount, location == null ? player.getPlayer().getLocation() : location, EXPSource.SOURCE); player.getCollectionSkills().giveExperience(profession, amount, location == null ? getPlayerLocation(player) : location, EXPSource.SOURCE);
else else
player.giveExperience(amount, location == null ? player.getPlayer().getLocation() : location, EXPSource.SOURCE); player.giveExperience(amount, location == null ? getPlayerLocation(player) : location, EXPSource.SOURCE);
}
private Location getPlayerLocation(PlayerData player) {
return player.isOnline() ? player.getPlayer().getLocation() : null;
} }
} }

View File

@ -76,7 +76,7 @@ public class LootChestRegion {
} }
public void spawnChest(PlayerData player) { public void spawnChest(PlayerData player) {
if(!player.isOnline()) return;
// first randomly determine the chest tier // first randomly determine the chest tier
ChestTier tier = rollTier(); ChestTier tier = rollTier();

View File

@ -14,6 +14,7 @@ public class CombatRunnable extends BukkitRunnable {
public CombatRunnable(PlayerData player) { public CombatRunnable(PlayerData player) {
this.player = player; this.player = player;
if(player.isOnline())
MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("now-in-combat").send(player.getPlayer());
Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true)); Bukkit.getPluginManager().callEvent(new PlayerCombatEvent(player, true));
runTaskTimer(MMOCore.plugin, 20, 20); runTaskTimer(MMOCore.plugin, 20, 20);

View File

@ -254,6 +254,7 @@ public class PlayerData extends OfflinePlayerData {
public void refreshVanillaExp() { public void refreshVanillaExp() {
if (MMOCore.plugin.configManager.overrideVanillaExp) { if (MMOCore.plugin.configManager.overrideVanillaExp) {
if(!isOnline()) return;
getPlayer().setLevel(getLevel()); getPlayer().setLevel(getLevel());
getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience()))); getPlayer().setExp(Math.max(0, Math.min(1, (float) experience / (float) getLevelUpExperience())));
} }
@ -333,6 +334,7 @@ public class PlayerData extends OfflinePlayerData {
} }
public void heal(double heal) { public void heal(double heal) {
if(!isOnline()) return;
double newest = Math.max(0, Math.min(getPlayer().getHealth() + heal, getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue())); double newest = Math.max(0, Math.min(getPlayer().getHealth() + heal, getPlayer().getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
if (getPlayer().getHealth() == newest) if (getPlayer().getHealth() == newest)
return; return;
@ -368,7 +370,7 @@ public class PlayerData extends OfflinePlayerData {
} }
public void log(Level level, String message) { public void log(Level level, String message) {
MMOCore.plugin.getLogger().log(level, "[Userdata:" + getPlayer().getName() + "] " + message); MMOCore.plugin.getLogger().log(level, "[Userdata:" + (isOnline() ? getPlayer().getName() : "Offline Player") + "] " + message);
} }
public void setLastFriendRequest(long ms) { public void setLastFriendRequest(long ms) {
@ -376,6 +378,7 @@ public class PlayerData extends OfflinePlayerData {
} }
public void sendFriendRequest(PlayerData target) { public void sendFriendRequest(PlayerData target) {
if(!isOnline() || !target.isOnline()) return;
setLastFriendRequest(System.currentTimeMillis()); setLastFriendRequest(System.currentTimeMillis());
FriendRequest request = new FriendRequest(this, target); FriendRequest request = new FriendRequest(this, target);
@ -395,10 +398,12 @@ public class PlayerData extends OfflinePlayerData {
giveStellium(-waypoint.getStelliumCost()); giveStellium(-waypoint.getStelliumCost());
if(!isOnline()) return;
new BukkitRunnable() { new BukkitRunnable() {
int x = getPlayer().getLocation().getBlockX(), y = getPlayer().getLocation().getBlockY(), z = getPlayer().getLocation().getBlockZ(), t; int x = getPlayer().getLocation().getBlockX(), y = getPlayer().getLocation().getBlockY(), z = getPlayer().getLocation().getBlockZ(), t;
public void run() { public void run() {
if(!isOnline()) return;
if (getPlayer().getLocation().getBlockX() != x || getPlayer().getLocation().getBlockY() != y if (getPlayer().getLocation().getBlockX() != x || getPlayer().getLocation().getBlockY() != y
|| getPlayer().getLocation().getBlockZ() != z) { || getPlayer().getLocation().getBlockZ() != z) {
getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, .5f); getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, .5f);
@ -442,7 +447,7 @@ public class PlayerData extends OfflinePlayerData {
} }
// display hologram // display hologram
if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms")) if (MMOCore.plugin.getConfig().getBoolean("display-exp-holograms") && isOnline())
if (loc != null && MMOCore.plugin.hologramSupport != null) if (loc != null && MMOCore.plugin.hologramSupport != null)
MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5), MMOCore.plugin.hologramSupport.displayIndicator(loc.add(.5, 1.5, .5),
MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("exp-hologram", "exp", "" + value).message(), getPlayer());
@ -471,9 +476,11 @@ public class PlayerData extends OfflinePlayerData {
if (level > oldLevel) { if (level > oldLevel) {
Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level)); Bukkit.getPluginManager().callEvent(new PlayerLevelUpEvent(this, null, oldLevel, level));
if(isOnline()) {
new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(getPlayer()); new ConfigMessage("level-up").addPlaceholders("level", "" + level).send(getPlayer());
getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1); getPlayer().playSound(getPlayer().getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1, 1);
new SmallParticleEffect(getPlayer(), Particle.SPELL_INSTANT); new SmallParticleEffect(getPlayer(), Particle.SPELL_INSTANT);
}
getStats().updateStats(); getStats().updateStats();
} }
@ -577,6 +584,7 @@ public class PlayerData extends OfflinePlayerData {
} }
public void displayActionBar(String message) { public void displayActionBar(String message) {
if(!isOnline()) return;
setActionBarTimeOut(MMOCore.plugin.actionBarManager.getTimeOut()); setActionBarTimeOut(MMOCore.plugin.actionBarManager.getTimeOut());
getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message)); getPlayer().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
} }
@ -728,7 +736,7 @@ public class PlayerData extends OfflinePlayerData {
*/ */
SkillResult cast = skill.getSkill().whenCast(this, skill); SkillResult cast = skill.getSkill().whenCast(this, skill);
if (!cast.isSuccessful()) { if (!cast.isSuccessful()) {
if (!skill.getSkill().isPassive()) { if (!skill.getSkill().isPassive() && isOnline()) {
if (cast.getCancelReason() == CancelReason.LOCKED) if (cast.getCancelReason() == CancelReason.LOCKED)
MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("not-unlocked-skill").send(getPlayer());

View File

@ -20,6 +20,7 @@ public class FriendRequest extends Request {
public void deny() { public void deny() {
MMOCore.plugin.requestManager.unregisterRequest(getUniqueId()); MMOCore.plugin.requestManager.unregisterRequest(getUniqueId());
if(!target.isOnline()) return;
target.getPlayer().playSound(target.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1); target.getPlayer().playSound(target.getPlayer().getLocation(), Sound.ENTITY_VILLAGER_NO, 1, 1);
} }
@ -27,8 +28,10 @@ public class FriendRequest extends Request {
getCreator().setLastFriendRequest(0); getCreator().setLastFriendRequest(0);
getCreator().addFriend(target.getUniqueId()); getCreator().addFriend(target.getUniqueId());
target.addFriend(getCreator().getUniqueId()); target.addFriend(getCreator().getUniqueId());
if(target.isOnline() && getCreator().isOnline()) {
MMOCore.plugin.configManager.getSimpleMessage("now-friends", "player", target.getPlayer().getName()).send(getCreator().getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("now-friends", "player", target.getPlayer().getName()).send(getCreator().getPlayer());
MMOCore.plugin.configManager.getSimpleMessage("now-friends", "player", getCreator().getPlayer().getName()).send(target.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("now-friends", "player", getCreator().getPlayer().getName()).send(target.getPlayer());
}
MMOCore.plugin.requestManager.unregisterRequest(getUniqueId()); MMOCore.plugin.requestManager.unregisterRequest(getUniqueId());
} }
} }

View File

@ -76,7 +76,7 @@ public class Party {
// transfer ownership // transfer ownership
if (owner.equals(data)) { if (owner.equals(data)) {
owner = members.get(0); owner = members.get(0);
if(notify) MMOCore.plugin.configManager.getSimpleMessage("transfer-party-ownership").send(owner.getPlayer()); if(notify && owner.isOnline()) MMOCore.plugin.configManager.getSimpleMessage("transfer-party-ownership").send(owner.getPlayer());
} }
} }
@ -100,6 +100,7 @@ public class Party {
public void sendPartyInvite(PlayerData inviter, PlayerData target) { public void sendPartyInvite(PlayerData inviter, PlayerData target) {
invites.put(target.getUniqueId(), System.currentTimeMillis()); invites.put(target.getUniqueId(), System.currentTimeMillis());
Request request = new PartyInvite(this, inviter, target); Request request = new PartyInvite(this, inviter, target);
if(inviter.isOnline() && target.isOnline())
new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString()) new ConfigMessage("party-invite").addPlaceholders("player", inviter.getPlayer().getName(), "uuid", request.getUniqueId().toString())
.sendAsJSon(target.getPlayer()); .sendAsJSon(target.getPlayer());
MMOCore.plugin.requestManager.registerRequest(request); MMOCore.plugin.requestManager.registerRequest(request);

View File

@ -28,8 +28,13 @@ public class PartyInvite extends Request {
} }
public void accept() { public void accept() {
if(getCreator().isOnline())
party.removeLastInvite(getCreator().getPlayer()); party.removeLastInvite(getCreator().getPlayer());
party.getMembers().forEach(member -> MMOCore.plugin.configManager.getSimpleMessage("party-joined-other", "player", target.getPlayer().getName()).send(member.getPlayer())); party.getMembers().forEach(member -> {
if(member.isOnline() && target.isOnline())
MMOCore.plugin.configManager.getSimpleMessage("party-joined-other", "player", target.getPlayer().getName()).send(member.getPlayer());
});
if(party.getOwner().isOnline() && target.isOnline())
MMOCore.plugin.configManager.getSimpleMessage("party-joined", "owner", party.getOwner().getPlayer().getName()).send(target.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("party-joined", "owner", party.getOwner().getPlayer().getName()).send(target.getPlayer());
party.addMember(target); party.addMember(target);
InventoryManager.PARTY_VIEW.newInventory(target).open(); InventoryManager.PARTY_VIEW.newInventory(target).open();

View File

@ -33,6 +33,7 @@ public class PlayerQuests {
this.playerData = playerData; this.playerData = playerData;
bossbar = MMOLib.plugin.getVersion().getWrapper().createBossBar(new NamespacedKey(MMOCore.plugin, "quest_bar_" + playerData.getUniqueId().toString()), "", BarColor.PURPLE, BarStyle.SEGMENTED_20, new BarFlag[0]); bossbar = MMOLib.plugin.getVersion().getWrapper().createBossBar(new NamespacedKey(MMOCore.plugin, "quest_bar_" + playerData.getUniqueId().toString()), "", BarColor.PURPLE, BarStyle.SEGMENTED_20, new BarFlag[0]);
if(playerData.isOnline())
bossbar.addPlayer(playerData.getPlayer()); bossbar.addPlayer(playerData.getPlayer());
} }

View File

@ -47,7 +47,7 @@ public class ClickonObjective extends Objective {
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.equals(getPlayer().getPlayer())) if (getPlayer().isOnline() && player.equals(getPlayer().getPlayer()))
if (player.getWorld().equals(loc.getWorld()) && event.getClickedBlock().getLocation().distanceSquared(loc) < rangeSquared) if (player.getWorld().equals(loc.getWorld()) && event.getClickedBlock().getLocation().distanceSquared(loc) < rangeSquared)
getQuestProgress().completeObjective(); getQuestProgress().completeObjective();
} }

View File

@ -46,7 +46,7 @@ public class GoToObjective extends Objective {
return; return;
Player player = event.getPlayer(); Player player = event.getPlayer();
if (player.equals(getPlayer().getPlayer())) if (getPlayer().isOnline() && player.equals(getPlayer().getPlayer()))
if (player.getWorld().equals(loc.getWorld()) && player.getLocation().distanceSquared(loc) < rangeSquared) if (player.getWorld().equals(loc.getWorld()) && player.getLocation().distanceSquared(loc) < rangeSquared)
getQuestProgress().completeObjective(); getQuestProgress().completeObjective();
} }

View File

@ -37,6 +37,7 @@ public class KillMobObjective extends Objective {
@EventHandler @EventHandler
public void a(EntityKillEntityEvent event) { public void a(EntityKillEntityEvent event) {
if(!getPlayer().isOnline()) return;
if (event.getTarget().getType() == type && event.getEntity().equals(getPlayer().getPlayer())) { if (event.getTarget().getType() == type && event.getEntity().equals(getPlayer().getPlayer())) {
count++; count++;
getQuestProgress().getPlayer().getQuestData().updateBossBar(); getQuestProgress().getPlayer().getQuestData().updateBossBar();

View File

@ -41,6 +41,7 @@ public class MineBlockObjective extends Objective {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void a(BlockBreakEvent event) { public void a(BlockBreakEvent event) {
if(!getQuestProgress().getPlayer().isOnline()) return;
if ((!playerPlaced) && event.getBlock().hasMetadata("player_placed")) if ((!playerPlaced) && event.getBlock().hasMetadata("player_placed"))
return; return;
if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getBlock().getType() == block) { if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getBlock().getType() == block) {
@ -53,6 +54,7 @@ public class MineBlockObjective extends Objective {
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void b(CustomBlockMineEvent event) { public void b(CustomBlockMineEvent event) {
if(!getQuestProgress().getPlayer().isOnline()) return;
if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getBlock().getType() == block) { if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getBlock().getType() == block) {
count++; count++;
getQuestProgress().getPlayer().getQuestData().updateBossBar(); getQuestProgress().getPlayer().getQuestData().updateBossBar();

View File

@ -19,6 +19,7 @@ public class CommandTrigger extends Trigger {
@Override @Override
public void apply(PlayerData player) { public void apply(PlayerData player) {
if(!player.isOnline()) return;
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), format(player.getPlayer())); Bukkit.dispatchCommand(Bukkit.getConsoleSender(), format(player.getPlayer()));
} }

View File

@ -22,6 +22,7 @@ public class ItemTrigger extends Trigger {
@Override @Override
public void apply(PlayerData player) { public void apply(PlayerData player) {
if(!player.isOnline()) return;
new SmartGive(player.getPlayer()).give(new ItemStack(material, amount)); new SmartGive(player.getPlayer()).give(new ItemStack(material, amount));
} }
} }

View File

@ -18,6 +18,7 @@ public class MessageTrigger extends Trigger {
@Override @Override
public void apply(PlayerData player) { public void apply(PlayerData player) {
if(!player.isOnline()) return;
player.getPlayer().sendMessage(format(player.getPlayer())); player.getPlayer().sendMessage(format(player.getPlayer()));
} }

View File

@ -21,6 +21,7 @@ public class SoundTrigger extends Trigger {
@Override @Override
public void apply(PlayerData player) { public void apply(PlayerData player) {
if(!player.isOnline()) return;
player.getPlayer().playSound(player.getPlayer().getLocation(), sound, vol, pitch); player.getPlayer().playSound(player.getPlayer().getLocation(), sound, vol, pitch);
} }
} }

View File

@ -150,6 +150,7 @@ public class MMOCoreUtils {
// TODO worldguard flags support for no target // TODO worldguard flags support for no target
public static boolean canTarget(PlayerData player, Entity target) { public static boolean canTarget(PlayerData player, Entity target) {
if(!player.isOnline()) return false;
// basic checks // basic checks
if (!(target instanceof LivingEntity) || player.getPlayer().equals(target) || target.isDead() || MMOLib.plugin.getEntities().findCustom(target)) if (!(target instanceof LivingEntity) || player.getPlayer().equals(target) || target.isDead() || MMOLib.plugin.getEntities().findCustom(target))

View File

@ -32,6 +32,7 @@ public class TalktoCitizenObjective extends Objective {
@EventHandler @EventHandler
public void a(CitizenInteractEvent event) { public void a(CitizenInteractEvent event) {
if(!getQuestProgress().getPlayer().isOnline()) return;
if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getNPC().getId() == id) if (event.getPlayer().equals(getQuestProgress().getPlayer().getPlayer()) && event.getNPC().getId() == id)
getQuestProgress().completeObjective(); getQuestProgress().completeObjective();
} }

View File

@ -62,7 +62,7 @@ public class MythicMobSkill extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
SkillResult cast = new SkillResult(data, skill); SkillResult cast = new SkillResult(data, skill);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
List<Entity> targets = new ArrayList<>(); List<Entity> targets = new ArrayList<>();

View File

@ -38,6 +38,7 @@ public class KillMythicFactionObjective extends Objective {
@EventHandler @EventHandler
public void a(MythicMobDeathEvent event) { public void a(MythicMobDeathEvent event) {
if(!getQuestProgress().getPlayer().isOnline()) return;
if (event.getKiller() instanceof Player if (event.getKiller() instanceof Player
&& event.getKiller().equals(getQuestProgress().getPlayer().getPlayer()) && event.getKiller().equals(getQuestProgress().getPlayer().getPlayer())
&& event.getMob().hasFaction() && event.getMob().getFaction().equals(factionName)) { && event.getMob().hasFaction() && event.getMob().getFaction().equals(factionName)) {

View File

@ -38,6 +38,7 @@ public class KillMythicMobObjective extends Objective {
@EventHandler @EventHandler
public void a(MythicMobDeathEvent event) { public void a(MythicMobDeathEvent event) {
if(!getQuestProgress().getPlayer().isOnline()) return;
if (event.getKiller() instanceof Player && event.getKiller().equals(getQuestProgress().getPlayer().getPlayer()) && event.getMob().getType().getInternalName().equals(internalName)) { if (event.getKiller() instanceof Player && event.getKiller().equals(getQuestProgress().getPlayer().getPlayer()) && event.getMob().getType().getInternalName().equals(internalName)) {
count++; count++;
getQuestProgress().getPlayer().getQuestData().updateBossBar(); getQuestProgress().getPlayer().getQuestData().updateBossBar();

View File

@ -28,6 +28,7 @@ public class MythicMobSkillTrigger extends Trigger {
@Override @Override
public void apply(PlayerData player) { public void apply(PlayerData player) {
if(!player.isOnline()) return;
List<Entity> targets = new ArrayList<>(); List<Entity> targets = new ArrayList<>();
targets.add(player.getPlayer()); targets.add(player.getPlayer());
MythicMobs.inst().getAPIHelper().castSkill(player.getPlayer(), this.skill.getInternalName(), player.getPlayer(), player.getPlayer().getEyeLocation(), targets, null, 1); MythicMobs.inst().getAPIHelper().castSkill(player.getPlayer(), this.skill.getInternalName(), player.getPlayer(), player.getPlayer().getEyeLocation(), targets, null, 1);

View File

@ -26,7 +26,7 @@ public class MoneyTrigger extends Trigger {
* instanced when the plugin loads and the economy has not been loaded * instanced when the plugin loads and the economy has not been loaded
* yet. * yet.
*/ */
if (!MMOCore.plugin.economy.isValid()) if (!MMOCore.plugin.economy.isValid() || !player.isOnline())
return; return;
if (operation == Operation.GIVE) if (operation == Operation.GIVE)

View File

@ -294,6 +294,7 @@ public class PlayerStats extends EditableInventory {
holders.register("attribute_points", "" + data.getAttributePoints()); holders.register("attribute_points", "" + data.getAttributePoints());
holders.register("progress", bar); holders.register("progress", bar);
holders.register("next_level", "" + nextLevelExp); holders.register("next_level", "" + nextLevelExp);
if(data.isOnline())
holders.register("player", "" + data.getPlayer().getName()); holders.register("player", "" + data.getPlayer().getName());
holders.register("class", "" + data.getProfess().getName()); holders.register("class", "" + data.getProfess().getName());

View File

@ -109,6 +109,7 @@ public class EditableFriendList extends EditableInventory {
PlayerData data = PlayerData.get(friend); PlayerData data = PlayerData.get(friend);
Placeholders holders = new Placeholders(); Placeholders holders = new Placeholders();
if(data.isOnline())
holders.register("name", data.getPlayer().getName()); holders.register("name", data.getPlayer().getName());
holders.register("class", data.getProfess().getName()); holders.register("class", data.getProfess().getName());
holders.register("level", data.getLevel()); holders.register("level", data.getLevel());

View File

@ -48,6 +48,8 @@ public class EditableGuildAdmin extends EditableInventory {
PlayerData member = PlayerData.get(inv.getPlayerData().getGuild().getMembers().get(n)); PlayerData member = PlayerData.get(inv.getPlayerData().getGuild().getMembers().get(n));
Placeholders holders = new Placeholders(); Placeholders holders = new Placeholders();
if(member.isOnline())
holders.register("name", member.getPlayer().getName()); holders.register("name", member.getPlayer().getName());
holders.register("class", member.getProfess().getName()); holders.register("class", member.getProfess().getName());
holders.register("level", "" + member.getLevel()); holders.register("level", "" + member.getLevel());
@ -64,6 +66,7 @@ public class EditableGuildAdmin extends EditableInventory {
if (meta instanceof SkullMeta) if (meta instanceof SkullMeta)
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> {
if(!member.isOnline()) return;
((SkullMeta) meta).setOwningPlayer(member.getPlayer()); ((SkullMeta) meta).setOwningPlayer(member.getPlayer());
disp.setItemMeta(meta); disp.setItemMeta(meta);
}); });

View File

@ -48,6 +48,7 @@ public class EditablePartyView extends EditableInventory {
PlayerData member = inv.getPlayerData().getParty().getMembers().get(n); PlayerData member = inv.getPlayerData().getParty().getMembers().get(n);
Placeholders holders = new Placeholders(); Placeholders holders = new Placeholders();
if(member.isOnline())
holders.register("name", member.getPlayer().getName()); holders.register("name", member.getPlayer().getName());
holders.register("class", member.getProfess().getName()); holders.register("class", member.getProfess().getName());
holders.register("level", "" + member.getLevel()); holders.register("level", "" + member.getLevel());
@ -67,6 +68,7 @@ public class EditablePartyView extends EditableInventory {
*/ */
if (meta instanceof SkullMeta) if (meta instanceof SkullMeta)
Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> { Bukkit.getScheduler().runTaskAsynchronously(MMOCore.plugin, () -> {
if(!member.isOnline()) return;
((SkullMeta) meta).setOwningPlayer(member.getPlayer()); ((SkullMeta) meta).setOwningPlayer(member.getPlayer());
disp.setItemMeta(meta); disp.setItemMeta(meta);
}); });

View File

@ -66,6 +66,7 @@ public class SpellCast implements Listener {
@EventHandler(ignoreCancelled = false) @EventHandler(ignoreCancelled = false)
public void onSkillCast(PlayerItemHeldEvent event) { public void onSkillCast(PlayerItemHeldEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(!playerData.isOnline()) return;
if (!event.getPlayer().equals(playerData.getPlayer())) if (!event.getPlayer().equals(playerData.getPlayer()))
return; return;
@ -92,6 +93,7 @@ public class SpellCast implements Listener {
@EventHandler @EventHandler
public void stopCasting(PlayerSwapHandItemsEvent event) { public void stopCasting(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer(); Player player = event.getPlayer();
if(!playerData.isOnline()) return;
if (event.getPlayer().equals(playerData.getPlayer()) && !player.isSneaking()) { if (event.getPlayer().equals(playerData.getPlayer()) && !player.isSneaking()) {
player.playSound(player.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1, 2); player.playSound(player.getLocation(), Sound.BLOCK_FIRE_EXTINGUISH, 1, 2);
MMOCore.plugin.configManager.getSimpleMessage("casting.no-longer").send(playerData.getPlayer()); MMOCore.plugin.configManager.getSimpleMessage("casting.no-longer").send(playerData.getPlayer());
@ -107,6 +109,7 @@ public class SpellCast implements Listener {
private String getFormat(PlayerData data) { private String getFormat(PlayerData data) {
String str = ""; String str = "";
if(!data.isOnline()) return str;
for (int j = 0; j < data.getBoundSkills().size(); j++) { for (int j = 0; j < data.getBoundSkills().size(); j++) {
SkillInfo skill = data.getBoundSkill(j); SkillInfo skill = data.getBoundSkill(j);
str += (str.isEmpty() ? "" : split) str += (str.isEmpty() ? "" : split)

View File

@ -17,6 +17,7 @@ public class DeathExperienceLoss implements Listener {
PlayerData data = PlayerData.get(event.getEntity()); PlayerData data = PlayerData.get(event.getEntity());
int loss = (int) (data.getExperience() * this.loss); int loss = (int) (data.getExperience() * this.loss);
data.setExperience(data.getExperience() - loss); data.setExperience(data.getExperience() - loss);
if(data.isOnline())
new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer()); new ConfigMessage("death-exp-loss").addPlaceholders("loss", "" + loss).send(data.getPlayer());
} }
} }

View File

@ -70,6 +70,7 @@ public class Ambers extends Skill implements Listener {
@Override @Override
public void run() { public void run() {
if(!data.isOnline()) return;
if (j++ > 66 || !data.getPlayer().getWorld().equals(loc.getWorld())) { if (j++ > 66 || !data.getPlayer().getWorld().equals(loc.getWorld())) {
cancel(); cancel();
return; return;

View File

@ -43,6 +43,7 @@ public class Combo_Attack extends Skill {
@Override @Override
public void run() { public void run() {
if(!data.isOnline()) return;
if (c++ > count) { if (c++ > count) {
cancel(); cancel();
return; return;

View File

@ -40,6 +40,7 @@ public class Control extends Skill {
if (!cast.isSuccessful()) if (!cast.isSuccessful())
return cast; return cast;
if(data.isOnline())
data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1); data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1);
cast.getTarget().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 2, 0)); cast.getTarget().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20 * 2, 0));
new TelekinesyRunnable(data, cast.getTarget(), cast.getModifier("knockback") / 100, cast.getModifier("duration")); new TelekinesyRunnable(data, cast.getTarget(), cast.getModifier("knockback") / 100, cast.getModifier("duration"));
@ -67,6 +68,7 @@ public class Control extends Skill {
@EventHandler @EventHandler
public void a(PlayerInteractEvent event) { public void a(PlayerInteractEvent event) {
if(!data.isOnline()) return;
if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK")) { if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK")) {
Vector vec = data.getPlayer().getEyeLocation().getDirection().multiply(3 * f); Vector vec = data.getPlayer().getEyeLocation().getDirection().multiply(3 * f);
vec.setY(Math.max(.5, vec.getY() / 2)); vec.setY(Math.max(.5, vec.getY() / 2));

View File

@ -31,7 +31,7 @@ public class Deep_Wound extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
TargetSkillResult cast = new TargetSkillResult(data, skill, 3); TargetSkillResult cast = new TargetSkillResult(data, skill, 3);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
LivingEntity target = cast.getTarget(); LivingEntity target = cast.getTarget();

View File

@ -45,6 +45,7 @@ public class Empowered_Attack extends Skill {
if (!cast.isSuccessful()) if (!cast.isSuccessful())
return cast; return cast;
if(data.isOnline())
data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1); data.getPlayer().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1);
new EmpoweredAttack(data, cast.getModifier("extra"), cast.getModifier("ratio"), cast.getModifier("radius")); new EmpoweredAttack(data, cast.getModifier("extra"), cast.getModifier("ratio"), cast.getModifier("radius"));
return cast; return cast;
@ -69,6 +70,7 @@ public class Empowered_Attack extends Skill {
this.r = ratio / 100; this.r = ratio / 100;
this.rad = radius; this.rad = radius;
if(player.isOnline())
new SmallParticleEffect(player.getPlayer(), Particle.FIREWORKS_SPARK); new SmallParticleEffect(player.getPlayer(), Particle.FIREWORKS_SPARK);
Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin); Bukkit.getPluginManager().registerEvents(this, MMOCore.plugin);
@ -81,6 +83,7 @@ public class Empowered_Attack extends Skill {
@EventHandler @EventHandler
public void a(PlayerAttackEvent event) { public void a(PlayerAttackEvent event) {
if(!player.isOnline()) return;
if (event.getPlayer().equals(player.getPlayer()) && event.getAttack().hasType(DamageType.WEAPON)) { if (event.getPlayer().equals(player.getPlayer()) && event.getAttack().hasType(DamageType.WEAPON)) {
close(); close();

View File

@ -36,9 +36,10 @@ public class Evade extends Skill {
SkillResult cast = new SkillResult(data, skill); SkillResult cast = new SkillResult(data, skill);
if (!cast.isSuccessful()) if (!cast.isSuccessful())
return cast; return cast;
if(data.isOnline()) {
data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 2); data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), VersionSound.ENTITY_ENDERMAN_TELEPORT.toSound(), 1, 2);
new SmallParticleEffect(data.getPlayer(), Particle.CLOUD); new SmallParticleEffect(data.getPlayer(), Particle.CLOUD);
}
new EvadeSkill(data, cast.getModifier("duration")); new EvadeSkill(data, cast.getModifier("duration"));
return cast; return cast;
} }
@ -61,6 +62,7 @@ public class Evade extends Skill {
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)
public void a(EntityDamageEvent event) { public void a(EntityDamageEvent event) {
if(!data.isOnline()) return;
if (event.getEntity().equals(data.getPlayer())) if (event.getEntity().equals(data.getPlayer()))
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -76,12 +76,15 @@ public class Fire_Rage extends Skill {
Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> close(), (long) (cast.getModifier("duration") * 20)); Bukkit.getScheduler().runTaskLater(MMOCore.plugin, () -> close(), (long) (cast.getModifier("duration") * 20));
runTaskTimer(MMOCore.plugin, 0, 1); runTaskTimer(MMOCore.plugin, 0, 1);
if(data.isOnline()) {
data.getPlayer().removePotionEffect(PotionEffectType.SLOW); data.getPlayer().removePotionEffect(PotionEffectType.SLOW);
data.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (cast.getModifier("duration") * 20), 1)); data.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.SLOW, (int) (cast.getModifier("duration") * 20), 1));
} }
}
@EventHandler @EventHandler
public void a(PlayerInteractEvent event) { public void a(PlayerInteractEvent event) {
if(!data.isOnline()) return;
if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK") && (System.currentTimeMillis() - last) > timeOut) { if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK") && (System.currentTimeMillis() - last) > timeOut) {
last = System.currentTimeMillis(); last = System.currentTimeMillis();
castEffect(); castEffect();
@ -92,6 +95,7 @@ public class Fire_Rage extends Skill {
} }
private void castEffect() { private void castEffect() {
if(!data.isOnline()) return;
VectorRotation rotation = new VectorRotation(data.getPlayer().getEyeLocation()); VectorRotation rotation = new VectorRotation(data.getPlayer().getEyeLocation());
for (double a = 0; a < Math.PI * 2; a += Math.PI / 13) { for (double a = 0; a < Math.PI * 2; a += Math.PI / 13) {
Vector vec = rotation.rotate(new Vector(Math.cos(a), Math.sin(a), 0)).add(data.getPlayer().getEyeLocation().getDirection().multiply(.5)).multiply(.3); Vector vec = rotation.rotate(new Vector(Math.cos(a), Math.sin(a), 0)).add(data.getPlayer().getEyeLocation().getDirection().multiply(.5)).multiply(.3);
@ -108,6 +112,7 @@ public class Fire_Rage extends Skill {
} }
private void fireball(boolean last) { private void fireball(boolean last) {
if(!data.isOnline()) return;
if (last) { if (last) {
data.getPlayer().removePotionEffect(PotionEffectType.SLOW); data.getPlayer().removePotionEffect(PotionEffectType.SLOW);
data.getPlayer().removePotionEffect(PotionEffectType.SLOW); data.getPlayer().removePotionEffect(PotionEffectType.SLOW);

View File

@ -35,7 +35,7 @@ public class Fire_Storm extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
TargetSkillResult cast = new TargetSkillResult(data, skill, 20); TargetSkillResult cast = new TargetSkillResult(data, skill, 20);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
LivingEntity target = cast.getTarget(); LivingEntity target = cast.getTarget();

View File

@ -37,7 +37,7 @@ public class Fireball extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
SkillResult cast = new SkillResult(data, skill); SkillResult cast = new SkillResult(data, skill);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1); data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 1, 1);

View File

@ -31,7 +31,7 @@ public class Furtive_Strike extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
TargetSkillResult cast = new TargetSkillResult(data, skill, 3); TargetSkillResult cast = new TargetSkillResult(data, skill, 3);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
LivingEntity target = cast.getTarget(); LivingEntity target = cast.getTarget();

View File

@ -40,7 +40,7 @@ public class Ice_Spikes extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
LocationSkillResult cast = new LocationSkillResult(data, skill, 20); LocationSkillResult cast = new LocationSkillResult(data, skill, 20);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
Location loc = cast.getHit(); Location loc = cast.getHit();

View File

@ -99,7 +99,7 @@ public class Power_Mark extends Skill implements Listener {
@Override @Override
public void run() { public void run() {
if(!data.isOnline()) return;
if (j++ > duration * 20) { if (j++ > duration * 20) {
unregister(); unregister();

View File

@ -36,7 +36,7 @@ public class Telekinesy extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
TargetSkillResult cast = new TargetSkillResult(data, skill, 7); TargetSkillResult cast = new TargetSkillResult(data, skill, 7);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1); data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 1);
@ -67,6 +67,7 @@ public class Telekinesy extends Skill {
@EventHandler @EventHandler
public void a(PlayerInteractEvent event) { public void a(PlayerInteractEvent event) {
if(!data.isOnline()) return;
if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK")) { if (event.getPlayer().equals(data.getPlayer()) && event.getAction().name().contains("LEFT_CLICK")) {
entity.setVelocity(data.getPlayer().getEyeLocation().getDirection().multiply(1.5 * f)); entity.setVelocity(data.getPlayer().getEyeLocation().getDirection().multiply(1.5 * f));
entity.getWorld().playSound(entity.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 1); entity.getWorld().playSound(entity.getLocation(), VersionSound.ENTITY_FIREWORK_ROCKET_BLAST.toSound(), 2, 1);

View File

@ -27,7 +27,7 @@ public class Warp extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
WarpCast cast = new WarpCast(data, skill); WarpCast cast = new WarpCast(data, skill);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 2); data.getPlayer().getWorld().playSound(data.getPlayer().getLocation(), Sound.BLOCK_END_PORTAL_FRAME_FILL, 1, 2);
@ -52,7 +52,8 @@ public class Warp extends Skill {
public WarpCast(PlayerData data, SkillInfo skill) { public WarpCast(PlayerData data, SkillInfo skill) {
super(data, skill); super(data, skill);
if (isSuccessful() && (block = data.getPlayer().getTargetBlock(null, (int) getModifier("range"))) == null) if(!data.isOnline()) abort();
else if (isSuccessful() && (block = data.getPlayer().getTargetBlock(null, (int) getModifier("range"))) == null)
abort(); abort();
} }
} }

View File

@ -35,7 +35,7 @@ public class Weaken extends Skill {
@Override @Override
public SkillResult whenCast(PlayerData data, SkillInfo skill) { public SkillResult whenCast(PlayerData data, SkillInfo skill) {
TargetSkillResult cast = new TargetSkillResult(data, skill, 7); TargetSkillResult cast = new TargetSkillResult(data, skill, 7);
if (!cast.isSuccessful()) if (!cast.isSuccessful() || !data.isOnline())
return cast; return cast;
LivingEntity target = cast.getTarget(); LivingEntity target = cast.getTarget();