mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-01-06 15:51:30 +00:00
Merge pull request #975 from CocoTheOwner/mm-fix
Fixed mythicmobs and implements it properly.
This commit is contained in:
@@ -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'
|
||||
|
||||
@@ -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<String> mobs;
|
||||
private BiFunction<String, Location, Entity> 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<String> 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<String>) getMobNames.invoke(mobManager);
|
||||
return mobs;
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
|
||||
IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
return isEnabled() ? MythicBukkit.inst().getMobManager().getMobNames() : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ public class IrisEntity extends IrisRegistrant {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (type.equals(EntityType.UNKNOWN)) {
|
||||
if (type.equals(EntityType.UNKNOWN) && !isSpecialType()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user