9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 20:19:06 +00:00

Mythic mobs support

This commit is contained in:
Daniel Mills
2020-10-13 05:53:50 -04:00
parent 38e62a9c98
commit 31320b4ab7
8 changed files with 174 additions and 4 deletions

View File

@@ -0,0 +1,64 @@
package com.volmit.iris.link;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.Plugin;
import com.volmit.iris.util.KList;
import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobsLink
{
public MythicMobsLink()
{
}
public boolean supported()
{
return getMythicMobs() != null;
}
public Entity spawn(String name, Location a)
{
if(!supported())
{
return null;
}
MythicMobs m = (MythicMobs) getMythicMobs();
return m.getMobManager().spawnMob(name, a).getEntity().getBukkitEntity();
}
public String[] getMythicMobTypes()
{
KList<String> v = new KList<>();
if(supported())
{
MythicMobs m = (MythicMobs) getMythicMobs();
for(MythicMob i : m.getMobManager().getMobTypes())
{
v.add(i.getInternalName());
}
}
return v.toArray(new String[v.size()]);
}
public Plugin getMythicMobs()
{
Plugin p = Bukkit.getPluginManager().getPlugin("MythicMobs");
if(p == null)
{
return null;
}
return p;
}
}