Merge branch 'master' of ssh://git.lumine.io:2222/mythiccraft/mmocore into abilitiesselfharmingfix

This commit is contained in:
RicardormDev 2021-02-20 12:26:43 -06:00
commit d3ae688da4
No known key found for this signature in database
GPG Key ID: DDC0B37FB6B8C169
4 changed files with 37 additions and 9 deletions

View File

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

View File

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

View File

@ -0,0 +1,27 @@
package net.Indyuce.mmocore.comp.mythicmobs.skill.handlers;
import io.lumine.mythic.utils.Schedulers;
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.event.EventHandler;
import org.bukkit.event.player.PlayerLoginEvent;
public class PlayerLoginSkillHandler extends PassiveMythicMobSkillHandler {
/**
* Used when a player logins
*
* @param skill
*/
public PlayerLoginSkillHandler(MythicMobSkill skill) {
super(skill);
}
@EventHandler
private void event(PlayerLoginEvent e){
Schedulers.sync().runLater(() -> {
castSkill(PlayerData.get( e.getPlayer()));
}, 50);
}
}

View File

@ -6,6 +6,7 @@ import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.block.BlockInfo; import net.Indyuce.mmocore.api.block.BlockInfo;
import net.Indyuce.mmocore.api.block.BlockInfo.BlockInfoOption; import net.Indyuce.mmocore.api.block.BlockInfo.BlockInfoOption;
import net.Indyuce.mmocore.api.block.VanillaBlockType; import net.Indyuce.mmocore.api.block.VanillaBlockType;
import net.Indyuce.mmocore.api.droptable.condition.ConditionInstance;
import net.Indyuce.mmocore.api.event.CustomBlockMineEvent; import net.Indyuce.mmocore.api.event.CustomBlockMineEvent;
import net.Indyuce.mmocore.api.player.PlayerData; import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.util.MMOCoreUtils; import net.Indyuce.mmocore.api.util.MMOCoreUtils;
@ -108,8 +109,10 @@ public class BlockListener implements Listener {
* can give exp to other TOOLS and display HOLOGRAMS * can give exp to other TOOLS and display HOLOGRAMS
*/ */
if (info.hasTriggers() && !block.hasMetadata("player_placed")) { if (info.hasTriggers() && !block.hasMetadata("player_placed")) {
PlayerData playerData = PlayerData.get(player); if (!info.hasDropTable() || info.hasDropTable() && info.getDropTable().areConditionsMet(new ConditionInstance(player))) {
info.getTriggers().forEach(trigger -> trigger.apply(playerData)); PlayerData playerData = PlayerData.get(player);
info.getTriggers().forEach(trigger -> trigger.apply(playerData));
}
} }
/* /*