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