Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
toxicity188 committed Nov 21, 2023
1 parent 48dfeda commit d18de86
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ enum class StandardDatabaseSupplier: DatabaseSupplier {
mkdir()
},"users").apply {
mkdir()
},"${player.uniqueId}.yml")
},"${player.uniqueId}.yml").apply {
if (!exists()) createNewFile()
}

override fun close() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kor.toxicity.questadder.util.event.mythicmobs;

import io.lumine.mythic.bukkit.events.MythicDamageEvent;
import io.lumine.mythic.core.mobs.ActiveMob;
import kor.toxicity.questadder.api.QuestAdder;
import kor.toxicity.questadder.api.mechanic.AbstractAction;
import kor.toxicity.questadder.api.mechanic.AbstractEvent;
Expand All @@ -13,14 +14,18 @@ public class EventMythicDamage extends AbstractEvent<MythicDamageEvent> {

@DataField(aliases = "t")
public EntityType type;
@DataField(aliases = "i")
public String id;

public EventMythicDamage(QuestAdder adder, AbstractAction action) {
super(adder, action, MythicDamageEvent.class);
}

@Override
public void invoke(@NotNull MythicDamageEvent event) {
if (type != null && event.getDamageMetadata().getDamager().getEntity().getBukkitEntity().getType() != type) return;
var caster = event.getCaster();
if (type != null && caster.getEntity().getBukkitEntity().getType() != type) return;
if (id != null && caster instanceof ActiveMob mob && !mob.getMobType().equals(id)) return;
if (event.getCaster().getEntity().getBukkitEntity() instanceof Player player) apply(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Map;
import java.util.function.Function;

public class ActionReflector<T extends DataObject> {
public final class ActionReflector<T extends DataObject> {

private final T object;

Expand Down

0 comments on commit d18de86

Please sign in to comment.