-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73e02d6
commit 937dbcf
Showing
7 changed files
with
118 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/java/com/fortlisa/mythicsk/api/events/MythicMobSpawnEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.fortlisa.mythicsk.api.events; | ||
|
||
import io.lumine.mythic.core.mobs.ActiveMob; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.event.Event; | ||
import org.bukkit.event.HandlerList; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class MythicMobSpawnEvent extends Event { | ||
private static final HandlerList handlers = new HandlerList(); | ||
private ActiveMob activeMob; | ||
|
||
public MythicMobSpawnEvent(ActiveMob activeMob) { | ||
this.activeMob = activeMob; | ||
} | ||
|
||
public ActiveMob getActiveMob() { | ||
return this.activeMob; | ||
} | ||
|
||
public Entity getEntity() { | ||
return this.activeMob.getEntity().getBukkitEntity(); | ||
} | ||
|
||
@Override | ||
public @NotNull HandlerList getHandlers() { | ||
return handlers; | ||
} | ||
|
||
public static HandlerList getHandlerList() { | ||
return handlers; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/fortlisa/mythicsk/skript/events/SimpleEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.fortlisa.mythicsk.skript.events; | ||
|
||
import ch.njol.skript.Skript; | ||
import ch.njol.skript.lang.util.SimpleEvent; | ||
import ch.njol.skript.registrations.EventValues; | ||
import ch.njol.skript.util.Getter; | ||
import com.fortlisa.mythicsk.api.events.MythicMobSpawnEvent; | ||
import io.lumine.mythic.core.mobs.ActiveMob; | ||
import org.bukkit.entity.Entity; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
public class SimpleEvents { | ||
static { | ||
//MythicMob spawn event | ||
Skript.registerEvent("MythicMob spawn", SimpleEvent.class, MythicMobSpawnEvent.class, | ||
"mythicmob spawn") | ||
.description("Called when a mythicMob spawn.") | ||
.examples(""); | ||
EventValues.registerEventValue(MythicMobSpawnEvent.class, ActiveMob.class, new Getter<ActiveMob, MythicMobSpawnEvent>() { | ||
@Override | ||
public @Nullable ActiveMob get(MythicMobSpawnEvent event) { | ||
return event.getActiveMob(); | ||
} | ||
}, 0); | ||
|
||
EventValues.registerEventValue(MythicMobSpawnEvent.class, Entity.class, new Getter<Entity, MythicMobSpawnEvent>() { | ||
@Override | ||
@Nullable | ||
public Entity get(MythicMobSpawnEvent e) { | ||
return e.getEntity(); | ||
}}, 0); | ||
} | ||
} |