mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 08:29:20 +00:00
Fixed miscellaneous bugs
This commit is contained in:
@@ -12,6 +12,7 @@ import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
|
||||
import com.willfp.ecobosses.commands.CommandEbdrop;
|
||||
import com.willfp.ecobosses.commands.CommandEbreload;
|
||||
import com.willfp.ecobosses.commands.CommandEbspawn;
|
||||
import com.willfp.ecobosses.commands.TabCompleterEbspawn;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -127,7 +128,8 @@ public class EcoBossesPlugin extends AbstractEcoPlugin {
|
||||
@Override
|
||||
public List<Class<?>> getUpdatableClasses() {
|
||||
return Arrays.asList(
|
||||
EcoBosses.class
|
||||
EcoBosses.class,
|
||||
TabCompleterEbspawn.class
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.bukkit.boss.BarColor;
|
||||
import org.bukkit.boss.BarFlag;
|
||||
import org.bukkit.boss.BarStyle;
|
||||
import org.bukkit.boss.BossBar;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -228,9 +229,12 @@ public class EcoBoss extends PluginDependent {
|
||||
|
||||
// Rewards
|
||||
this.drops = new ArrayList<>();
|
||||
this.getConfig().getSection("rewards.drops").getKeys(false).forEach(s -> {
|
||||
ConfigurationSection dropsSection = this.getConfig().getSectionOrNull("rewards.drops");
|
||||
if (dropsSection != null) {
|
||||
dropsSection.getKeys(false).forEach(s -> {
|
||||
this.drops.add(this.getConfig().getConfig().getItemStack("rewards.drops." + s));
|
||||
});
|
||||
}
|
||||
this.experienceOptions = new ExperienceOptions(
|
||||
this.getConfig().getInt("rewards.xp.minimum"),
|
||||
this.getConfig().getInt("rewards.xp.maximum")
|
||||
@@ -317,7 +321,7 @@ public class EcoBoss extends PluginDependent {
|
||||
}
|
||||
|
||||
// Spawn egg
|
||||
Material eggMaterial = Material.matchMaterial("spawn-egg.egg-material");
|
||||
Material eggMaterial = Material.matchMaterial(this.getConfig().getString("spawn-egg.egg-material").toUpperCase());
|
||||
assert eggMaterial != null;
|
||||
this.spawnEgg = new ItemStack(eggMaterial);
|
||||
SpawnEggMeta meta = (SpawnEggMeta) this.spawnEgg.getItemMeta();
|
||||
@@ -357,6 +361,8 @@ public class EcoBoss extends PluginDependent {
|
||||
assert maxHealth != null;
|
||||
maxHealth.setBaseValue(this.getMaxHealth());
|
||||
|
||||
entity.setHealth(maxHealth.getValue());
|
||||
|
||||
AttributeInstance attackDamage = entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE);
|
||||
assert attackDamage != null;
|
||||
attackDamage.setBaseValue(this.getAttackDamage());
|
||||
@@ -418,7 +424,7 @@ public class EcoBoss extends PluginDependent {
|
||||
|
||||
for (EffectOption effect : this.getEffects()) {
|
||||
if (NumberUtils.randFloat(0, 100) > effect.getChance()) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
player.addPotionEffect(new PotionEffect(effect.getEffectType(), effect.getDuration(), effect.getLevel()));
|
||||
@@ -440,7 +446,7 @@ public class EcoBoss extends PluginDependent {
|
||||
|
||||
for (SummonsOption summon : this.getSummons()) {
|
||||
if (NumberUtils.randFloat(0, 100) > summon.getChance()) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
Location loc = player.getLocation().add(NumberUtils.randInt(2, 6), 0, NumberUtils.randInt(2, 6));
|
||||
|
||||
@@ -76,10 +76,8 @@ public class AttackListeners implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (boss.isAttackOnInjure()) {
|
||||
boss.handleAttack(entity, player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a boss is damaged.
|
||||
|
||||
@@ -19,13 +19,15 @@ public class BossEntityUtils {
|
||||
*/
|
||||
@Nullable
|
||||
public static BossType getBossType(@NotNull final String id) {
|
||||
Class<? extends CustomEntity<? extends LivingEntity>> proxy = CustomEntities.getEntityClass(id.toLowerCase());
|
||||
try {
|
||||
Class<? extends LivingEntity> type = (Class<? extends LivingEntity>) EntityType.valueOf(id.toUpperCase()).getEntityClass();
|
||||
assert type != null;
|
||||
return new VanillaBossType(type);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Class<? extends CustomEntity<? extends LivingEntity>> proxy = CustomEntities.getEntityClass(id.toLowerCase());
|
||||
if (proxy != null) {
|
||||
return new CustomBossType(proxy);
|
||||
}
|
||||
if (type != null) {
|
||||
return new VanillaBossType(type);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.willfp.ecobosses.commands;
|
||||
|
||||
import com.willfp.eco.util.NumberUtils;
|
||||
import com.willfp.eco.util.command.AbstractCommand;
|
||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -24,6 +27,12 @@ public class CommandEbdrop extends AbstractCommand {
|
||||
@NotNull final List<String> args) {
|
||||
Player player = (Player) sender;
|
||||
ItemStack itemStack = player.getInventory().getItemInMainHand();
|
||||
String key = String.valueOf(NumberUtils.randInt(0, 100000));
|
||||
YamlConfiguration jank = new YamlConfiguration();
|
||||
jank.set(key, itemStack);
|
||||
|
||||
Bukkit.getLogger().info("Copy this into the drops section of your boss yml!");
|
||||
Bukkit.getLogger().info("\n" + jank.saveToString());
|
||||
|
||||
player.sendMessage(this.getPlugin().getLangYml().getMessage("sent-drop"));
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ name: "Illusioner" # Display name
|
||||
base-mob: custom_illusioner # Any existing mob - custom_illusioner is also accepted (like in the old Illusioner plugin)
|
||||
|
||||
spawn-egg:
|
||||
egg-material: illusioner_spawn_egg
|
||||
egg-material: squid_spawn_egg
|
||||
display-name: "Illusioner Spawn Egg"
|
||||
lore: []
|
||||
|
||||
@@ -76,7 +76,7 @@ sounds:
|
||||
|
||||
spawn: # On spawn
|
||||
- "entity_illusioner_mirror_move:1000:0.5"
|
||||
- "entity_wither_spawn:1000L:2"
|
||||
- "entity_wither_spawn:1000:2"
|
||||
|
||||
death: # On death
|
||||
- "entity_evoker_prepare_wololo:50:0.8"
|
||||
|
||||
@@ -5,6 +5,8 @@ api-version: 1.15
|
||||
authors: [Auxilor]
|
||||
website: willfp.com
|
||||
load: STARTUP
|
||||
depend:
|
||||
- eco
|
||||
|
||||
commands:
|
||||
ebreload:
|
||||
|
||||
Reference in New Issue
Block a user