mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-22 00:19:30 +00:00
General improvements
This commit is contained in:
@@ -19,6 +19,7 @@ import net.minecraft.server.v1_16_R3.PathfinderGoalRandomStroll;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R3.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
import org.bukkit.craftbukkit.v1_16_R3.util.CraftNamespacedKey;
|
||||||
|
import org.bukkit.entity.Illusioner;
|
||||||
import org.bukkit.persistence.PersistentDataType;
|
import org.bukkit.persistence.PersistentDataType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@@ -52,9 +53,9 @@ public class CustomIllusioner extends EntityIllagerIllusioner implements CustomI
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CustomIllusionerProxy spawn(@NotNull final Location location) {
|
public Illusioner spawn(@NotNull final Location location) {
|
||||||
CustomIllusioner illusioner = new CustomIllusioner(location);
|
CustomIllusioner illusioner = new CustomIllusioner(location);
|
||||||
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
((CraftWorld) location.getWorld()).getHandle().addEntity(illusioner);
|
||||||
return illusioner;
|
return (Illusioner) illusioner.getBukkitEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,17 @@
|
|||||||
package com.willfp.ecobosses.bosses;
|
package com.willfp.ecobosses.bosses;
|
||||||
|
|
||||||
import com.willfp.eco.internal.config.AbstractUndefinedConfig;
|
import com.willfp.eco.internal.config.AbstractUndefinedConfig;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
import com.willfp.eco.util.internal.PluginDependent;
|
||||||
|
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
public class EcoBoss extends PluginDependent {
|
||||||
public class EcoBoss {
|
|
||||||
/**
|
/**
|
||||||
* Instance of EcoArmor.
|
* The name of the boss.
|
||||||
*/
|
|
||||||
private static final EcoBossesPlugin PLUGIN = EcoBossesPlugin.getInstance();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the set.
|
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
private final String name;
|
private final String name;
|
||||||
@@ -32,9 +27,12 @@ public class EcoBoss {
|
|||||||
*
|
*
|
||||||
* @param name The name of the set.
|
* @param name The name of the set.
|
||||||
* @param config The set's config.
|
* @param config The set's config.
|
||||||
|
* @param plugin Instance of EcoBosses.
|
||||||
*/
|
*/
|
||||||
public EcoBoss(@NotNull final String name,
|
public EcoBoss(@NotNull final String name,
|
||||||
@NotNull final AbstractUndefinedConfig config) {
|
@NotNull final AbstractUndefinedConfig config,
|
||||||
|
@NotNull final AbstractEcoPlugin plugin) {
|
||||||
|
super(plugin);
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
@@ -68,4 +66,4 @@ public class EcoBoss {
|
|||||||
+ this.getName()
|
+ this.getName()
|
||||||
+ "}";
|
+ "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class EcoBosses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (String defaultSetName : DEFAULT_BOSSES) {
|
for (String defaultSetName : DEFAULT_BOSSES) {
|
||||||
new EcoBoss(defaultSetName, new BaseBossConfig(defaultSetName));
|
new EcoBoss(defaultSetName, new BaseBossConfig(defaultSetName), EcoBossesPlugin.getInstance());
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -69,9 +69,10 @@ public class EcoBosses {
|
|||||||
.filter(Files::isRegularFile)
|
.filter(Files::isRegularFile)
|
||||||
.forEach(path -> {
|
.forEach(path -> {
|
||||||
String name = path.getFileName().toString().replace(".yml", "");
|
String name = path.getFileName().toString().replace(".yml", "");
|
||||||
new EcoBoss (
|
new EcoBoss(
|
||||||
name,
|
name,
|
||||||
new CustomConfig(name, YamlConfiguration.loadConfiguration(path.toFile()))
|
new CustomConfig(name, YamlConfiguration.loadConfiguration(path.toFile())),
|
||||||
|
EcoBossesPlugin.getInstance()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
public class DeathListeners implements Listener {
|
public class DeathListeners implements Listener {
|
||||||
/**
|
/**
|
||||||
* Called when the illusioner dies.
|
* Called when a boss dies.
|
||||||
*
|
*
|
||||||
* @param event The event to listen for.
|
* @param event The event to listen for.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,17 +1,8 @@
|
|||||||
package com.willfp.ecobosses.proxy.proxies;
|
package com.willfp.ecobosses.proxy.proxies;
|
||||||
|
|
||||||
import com.willfp.eco.util.plugin.AbstractEcoPlugin;
|
|
||||||
import com.willfp.eco.util.proxy.AbstractProxy;
|
import com.willfp.eco.util.proxy.AbstractProxy;
|
||||||
import org.bukkit.Location;
|
import com.willfp.ecobosses.proxy.util.CustomEntity;
|
||||||
import org.bukkit.boss.BossBar;
|
import org.bukkit.entity.Illusioner;
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public interface CustomIllusionerProxy extends AbstractProxy {
|
public interface CustomIllusionerProxy extends AbstractProxy, CustomEntity<Illusioner> {
|
||||||
/**
|
|
||||||
* Spawn an illusioner.
|
|
||||||
*
|
|
||||||
* @param location The location to spawn it at.
|
|
||||||
* @return The created illusioner.
|
|
||||||
*/
|
|
||||||
CustomIllusionerProxy spawn(@NotNull Location location);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.willfp.ecobosses.proxy.util;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public interface CustomEntity<T> {
|
||||||
|
/**
|
||||||
|
* Spawn a custom entity.
|
||||||
|
*
|
||||||
|
* @param location The location to spawn it at.
|
||||||
|
* @return The created entity.
|
||||||
|
*/
|
||||||
|
T spawn(@NotNull Location location);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user