diff --git a/build.gradle b/build.gradle index d042325ce..634aa8e11 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ def main = 'com.volmit.iris.Iris' registerCustomOutputTask('Cyberpwn', 'C://Users/cyberpwn/Documents/development/server/plugins') registerCustomOutputTask('Psycho', 'C://Dan/MinecraftDevelopment/Server/plugins') registerCustomOutputTask('ArcaneArts', 'C://Users/arcane/Documents/development/server/plugins') -registerCustomOutputTask('Coco', 'D://Documents/MC/plugins') +registerCustomOutputTask('Coco', 'D://mcsm/plugins') registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins') registerCustomOutputTask('Vatuu', 'D://Minecraft/Servers/1.19.3/plugins') // ========================== UNIX ============================== @@ -75,7 +75,7 @@ repositories { } } maven { url "https://arcanearts.jfrog.io/artifactory/archives" } - + maven { url "https://mvn.lumine.io/repository/maven-public/" } } /** @@ -134,6 +134,7 @@ dependencies { implementation "net.kyori:adventure-text-minimessage:4.11.0" implementation 'net.kyori:adventure-platform-bukkit:4.1.0' implementation 'net.kyori:adventure-api:4.11.0' + implementation 'io.lumine:Mythic-Dist:5.2.1' // Dynamically Loaded implementation 'io.timeandspace:smoothie-map:2.0.2' diff --git a/src/main/java/com/volmit/iris/core/link/MythicMobsLink.java b/src/main/java/com/volmit/iris/core/link/MythicMobsLink.java index dea27c957..985e97511 100644 --- a/src/main/java/com/volmit/iris/core/link/MythicMobsLink.java +++ b/src/main/java/com/volmit/iris/core/link/MythicMobsLink.java @@ -18,23 +18,17 @@ package com.volmit.iris.core.link; +import io.lumine.mythic.bukkit.MythicBukkit; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Entity; import org.bukkit.plugin.Plugin; import javax.annotation.Nullable; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.Collection; -import java.util.function.BiFunction; public class MythicMobsLink { - private Collection mobs; - private BiFunction spawnMobFunction; - public MythicMobsLink() { } @@ -56,59 +50,10 @@ public class MythicMobsLink { */ public @Nullable Entity spawnMob(String mob, Location location) { - if (!isEnabled()) return null; - - if (spawnMobFunction != null) { - return spawnMobFunction.apply(mob, location); - } - - try { - Class mythicMobClass = Class.forName("io.lumine.mythic.bukkit.MythicBukkit"); - Method getInst = mythicMobClass.getDeclaredMethod("inst"); - Object inst = getInst.invoke(null); - Method getAPIHelper = mythicMobClass.getDeclaredMethod("getAPIHelper"); - Object apiHelper = getAPIHelper.invoke(inst); - Method spawnMobMethod = apiHelper.getClass().getDeclaredMethod("spawnMythicMob", String.class, Location.class); - - spawnMobFunction = (str, loc) -> { - try { - return (Entity) spawnMobMethod.invoke(apiHelper, str, loc); - } catch (InvocationTargetException | IllegalAccessException e) { - e.printStackTrace(); - } - return null; - }; - - return spawnMobFunction.apply(mob, location); - } catch (Exception e) { - e.printStackTrace(); - - } - return null; + return isEnabled() ? MythicBukkit.inst().getMobManager().spawnMob(mob, location).getEntity().getBukkitEntity() : null; } public Collection getMythicMobTypes() { - if (mobs != null) { - return mobs; - } - - if (isEnabled()) { - - try { - Class mythicMobClass = Class.forName("io.lumine.xikage.mythicmobs.MythicMobs"); - Method getInst = mythicMobClass.getDeclaredMethod("inst"); - Object inst = getInst.invoke(null); - Method getMobManager = mythicMobClass.getDeclaredMethod("getMobManager"); - Object mobManager = getMobManager.invoke(inst); - Method getMobNames = mobManager.getClass().getDeclaredMethod("getMobNames"); - mobs = (Collection) getMobNames.invoke(mobManager); - return mobs; - } catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException | - IllegalAccessException e) { - e.printStackTrace(); - } - } - - return new ArrayList<>(); + return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : null; } } diff --git a/src/main/java/com/volmit/iris/engine/object/IrisEntity.java b/src/main/java/com/volmit/iris/engine/object/IrisEntity.java index f3ef5876c..8dabc091d 100644 --- a/src/main/java/com/volmit/iris/engine/object/IrisEntity.java +++ b/src/main/java/com/volmit/iris/engine/object/IrisEntity.java @@ -420,7 +420,7 @@ public class IrisEntity extends IrisRegistrant { return null; } - if (type.equals(EntityType.UNKNOWN)) { + if (type.equals(EntityType.UNKNOWN) && !isSpecialType()) { return null; }