mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 07:29:21 +00:00
11
build.gradle
11
build.gradle
@@ -39,6 +39,7 @@ allprojects {
|
||||
maven { url 'https://maven.sk89q.com/repo/' }
|
||||
maven { url 'https://github.com/factions-site/repo/raw/public/' }
|
||||
maven { url 'https://repo.extendedclip.com/content/repositories/placeholderapi/' }
|
||||
maven { url 'https://mvn.lumine.io/repository/maven-public/' }
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -85,7 +86,15 @@ shadowJar {
|
||||
}
|
||||
|
||||
jar {
|
||||
archiveFileName = findProperty("plugin-name") + " v" + findProperty("version") + " " + "unshaded" + ".jar"
|
||||
archiveFileName = findProperty("plugin-name") + " v" + findProperty("version") + ".jar"
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from(components.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
group = 'com.willfp'
|
||||
|
||||
@@ -6,4 +6,5 @@ dependencies {
|
||||
compileOnly 'commons-io:commons-io:2.8.0'
|
||||
compileOnly 'com.destroystokyo.paper:paper-api:1.16.3-R0.1-SNAPSHOT'
|
||||
compileOnly 'com.github.lokka30:LevelledMobs:3.1.4'
|
||||
compileOnly 'io.lumine.xikage:MythicMobs:4.9.1'
|
||||
}
|
||||
@@ -3,12 +3,9 @@ package com.willfp.ecobosses;
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.command.impl.PluginCommand;
|
||||
import com.willfp.eco.core.integrations.IntegrationLoader;
|
||||
import com.willfp.ecobosses.bosses.listeners.AttackListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.AutoSpawnTimer;
|
||||
import com.willfp.ecobosses.bosses.listeners.DeathListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.PassiveListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
|
||||
import com.willfp.ecobosses.bosses.listeners.*;
|
||||
import com.willfp.ecobosses.bosses.util.BossUtils;
|
||||
import com.willfp.ecobosses.bosses.util.bosstype.BossEntityUtils;
|
||||
import com.willfp.ecobosses.commands.CommandEcobosses;
|
||||
import com.willfp.ecobosses.integrations.levelledmobs.LevelledMobsListener;
|
||||
import com.willfp.ecobosses.util.DiscoverRecipeListener;
|
||||
@@ -46,7 +43,7 @@ public class EcoBossesPlugin extends EcoPlugin {
|
||||
|
||||
@Override
|
||||
protected List<PluginCommand> loadPluginCommands() {
|
||||
return Arrays.asList(
|
||||
return List.of(
|
||||
new CommandEcobosses(this)
|
||||
);
|
||||
}
|
||||
@@ -54,7 +51,8 @@ public class EcoBossesPlugin extends EcoPlugin {
|
||||
@Override
|
||||
protected List<IntegrationLoader> loadIntegrationLoaders() {
|
||||
return Arrays.asList(
|
||||
new IntegrationLoader("LevelledMobs", () -> this.getEventManager().registerListener(new LevelledMobsListener()))
|
||||
new IntegrationLoader("LevelledMobs", () -> this.getEventManager().registerListener(new LevelledMobsListener())),
|
||||
new IntegrationLoader("MythicMobs", () -> BossEntityUtils.mythicMobs = true)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,11 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
||||
@Getter
|
||||
private final int attackDamage;
|
||||
|
||||
/**
|
||||
* Age state.
|
||||
*/
|
||||
@Getter
|
||||
private final boolean baby;
|
||||
|
||||
/**
|
||||
* The follow range.
|
||||
@@ -325,6 +330,7 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
|
||||
this.name = name;
|
||||
this.livingBosses = new HashMap<>();
|
||||
this.isGlowing = this.getConfig().getBool("glowing");
|
||||
this.baby = this.getConfig().getBool("baby");
|
||||
|
||||
this.displayName = this.getConfig().getString("name");
|
||||
|
||||
|
||||
@@ -13,12 +13,15 @@ import com.willfp.ecobosses.bosses.tick.tickers.NamePlaceholderTicker;
|
||||
import com.willfp.ecobosses.bosses.tick.tickers.TargetTicker;
|
||||
import com.willfp.ecobosses.bosses.util.obj.EquipmentPiece;
|
||||
import com.willfp.ecobosses.bosses.util.obj.OptionedSound;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.attribute.Attribute;
|
||||
import org.bukkit.attribute.AttributeInstance;
|
||||
import org.bukkit.attribute.AttributeModifier;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.boss.BarFlag;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
@@ -105,6 +108,11 @@ public class LivingEcoBoss extends PluginDependent<EcoPlugin> {
|
||||
|
||||
if (boss.isGlowing()) entity.addPotionEffect(new PotionEffect(PotionEffectType.GLOWING, Integer.MAX_VALUE, 1, false, false, false));
|
||||
|
||||
if (entity instanceof Ageable ageable) {
|
||||
if (boss.isBaby()) ageable.setBaby();
|
||||
else ageable.setAdult();
|
||||
}
|
||||
|
||||
if (boss.getTimeToLive() > 0) {
|
||||
entity.setMetadata("death-time", this.getPlugin().getMetadataValueFactory().create(System.currentTimeMillis() + (boss.getTimeToLive() * 1000L)));
|
||||
}
|
||||
|
||||
@@ -1,26 +1,57 @@
|
||||
package com.willfp.ecobosses.bosses.util.bosstype;
|
||||
|
||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@UtilityClass
|
||||
@SuppressWarnings("unchecked")
|
||||
public class BossEntityUtils {
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static boolean mythicMobs = false;
|
||||
|
||||
/**
|
||||
* Get boss type.
|
||||
*
|
||||
* @param id The name.
|
||||
* @return The boss type.
|
||||
*/
|
||||
public static BossType getBossType(@NotNull final String id) {
|
||||
public static BossType getBossType(@NotNull String id) {
|
||||
|
||||
if (id.startsWith("mythicmobs_")) {
|
||||
if (mythicMobs) {
|
||||
int level;
|
||||
|
||||
try {
|
||||
level = Integer.parseInt(Arrays.stream(id.split("_")).toList().get(id.split("_").length-1));
|
||||
} catch (NumberFormatException exception) {
|
||||
level = 1;
|
||||
}
|
||||
|
||||
MythicMob mob = MythicMobs.inst().getMobManager().getMythicMob(id.replace("mythicmobs_", "").replace("_"+level, ""));
|
||||
|
||||
if (mob != null) {
|
||||
return new MythicMobsBossType(mob, level);
|
||||
}
|
||||
else id = "zombie";
|
||||
} else id = "zombie";
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
||||
assert type != null;
|
||||
return new VanillaBossType(type);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
} catch (IllegalArgumentException ignored) {}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.willfp.ecobosses.bosses.util.bosstype;
|
||||
|
||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||
import io.lumine.xikage.mythicmobs.adapters.AbstractLocation;
|
||||
import io.lumine.xikage.mythicmobs.adapters.AbstractWorld;
|
||||
import io.lumine.xikage.mythicmobs.api.exceptions.InvalidMobTypeException;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MythicMobsBossType extends BossType {
|
||||
|
||||
/**
|
||||
* The entity type.
|
||||
*/
|
||||
private final MythicMob boss;
|
||||
|
||||
/**
|
||||
* Level of MythicMobs mob
|
||||
*/
|
||||
private final int level;
|
||||
|
||||
/**
|
||||
* Create new vanilla boss type.
|
||||
*
|
||||
* @param boss The MythicMob.
|
||||
*/
|
||||
public MythicMobsBossType(MythicMob boss, int level) {
|
||||
this.boss = boss;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LivingEntity spawnBossEntity(@NotNull Location location) {
|
||||
try {
|
||||
return (LivingEntity) MythicMobs.inst().getAPIHelper().spawnMythicMob(boss, location, level);
|
||||
} catch (InvalidMobTypeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ enabled: true
|
||||
|
||||
name: "&fAlpha Wolf &7| &c%health%♥ &7| &e%time%" # Display name
|
||||
base-mob: wolf
|
||||
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||
|
||||
bossbar:
|
||||
enabled: true
|
||||
|
||||
@@ -2,6 +2,7 @@ enabled: true
|
||||
|
||||
name: "&9Dark Guardian &7| &c%health%♥ &7| &e%time%" # Display name
|
||||
base-mob: ravager
|
||||
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||
|
||||
bossbar:
|
||||
enabled: true
|
||||
|
||||
@@ -2,6 +2,7 @@ enabled: true
|
||||
|
||||
name: "&8Steel Golem &7| &c%health%♥ &7| &e%time%" # Display name
|
||||
base-mob: iron_golem
|
||||
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||
|
||||
bossbar:
|
||||
enabled: true
|
||||
|
||||
@@ -2,6 +2,7 @@ enabled: true
|
||||
|
||||
name: "&4Tarantula &7| &c%health%♥ &7| &e%time%" # Display name
|
||||
base-mob: cave_spider
|
||||
baby: false # If set to true: will make the boss mob baby (if possible)
|
||||
|
||||
bossbar:
|
||||
enabled: true
|
||||
|
||||
@@ -5,6 +5,9 @@ api-version: 1.16
|
||||
authors: [Auxilor]
|
||||
website: willfp.com
|
||||
load: STARTUP
|
||||
softdepend:
|
||||
- MythicMobs
|
||||
- LevelledMobs
|
||||
depend:
|
||||
- eco
|
||||
|
||||
|
||||
Reference in New Issue
Block a user