Added new passive type "player_login", this is used to handle passive abilities through mythicmobs that you want active the entire time the player is on.

This commit is contained in:
Joshua 2021-02-19 13:03:32 -06:00
parent b9ae31467d
commit f470351b66
3 changed files with 29 additions and 7 deletions

View File

@ -122,7 +122,7 @@
<dependency>
<groupId>io.lumine</groupId>
<artifactId>MythicLib</artifactId>
<version>1.0.2</version>
<version>1.0.8-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -1,11 +1,6 @@
package net.Indyuce.mmocore.comp.mythicmobs.skill;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.EntityDeathSkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.PlayerAttackSkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.PlayerDamageByEntitySkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.PlayerDamageSkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.PlayerDeathSkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.ShootBowSkillHandler;
import net.Indyuce.mmocore.comp.mythicmobs.skill.handlers.*;
public enum PassiveSkillType {
PLAYER_ATTACK,
@ -13,6 +8,7 @@ public enum PassiveSkillType {
PLAYER_DAMAGE_BY_ENTITY,
PLAYER_DEATH,
PLAYER_KILL_ENTITY,
PLAYER_LOGIN,
SHOOT_BOW;
public PassiveMythicMobSkillHandler getHandler(MythicMobSkill skill) {
@ -28,6 +24,8 @@ public enum PassiveSkillType {
return new PlayerDeathSkillHandler(skill);
if (this == SHOOT_BOW)
return new ShootBowSkillHandler(skill);
if (this == PLAYER_LOGIN)
return new PlayerLoginSkillHandler(skill);
throw new NullPointerException();
}
}

View File

@ -0,0 +1,24 @@
package net.Indyuce.mmocore.comp.mythicmobs.skill.handlers;
import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.comp.mythicmobs.skill.MythicMobSkill;
import net.Indyuce.mmocore.comp.mythicmobs.skill.PassiveMythicMobSkillHandler;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerLoginEvent;
public class PlayerLoginSkillHandler extends PassiveMythicMobSkillHandler {
/**
* Core class for all passive types
*
* @param skill
*/
public PlayerLoginSkillHandler(MythicMobSkill skill) {
super(skill);
}
@EventHandler
private void event(PlayerLoginEvent e){
castSkill(PlayerData.get((Player) e));
}
}