9
0
mirror of https://github.com/Auxilor/EcoMobs.git synced 2025-12-20 15:39:31 +00:00

Updated to eco 6

This commit is contained in:
Auxilor
2021-07-21 18:28:17 +01:00
parent 9486903895
commit 3e4d3af215
12 changed files with 15 additions and 120 deletions

View File

@@ -46,7 +46,7 @@ allprojects {
} }
dependencies { dependencies {
compileOnly 'com.willfp:eco:5.7.1' compileOnly 'com.willfp:eco:6.0.0'
compileOnly 'org.jetbrains:annotations:19.0.0' compileOnly 'org.jetbrains:annotations:19.0.0'

View File

@@ -1,10 +1,7 @@
package com.willfp.ecobosses; package com.willfp.ecobosses;
import com.willfp.eco.core.AbstractPacketAdapter;
import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.command.impl.PluginCommand; import com.willfp.eco.core.command.impl.PluginCommand;
import com.willfp.eco.core.integrations.IntegrationLoader;
import com.willfp.ecobosses.bosses.EcoBosses;
import com.willfp.ecobosses.bosses.listeners.AttackListeners; import com.willfp.ecobosses.bosses.listeners.AttackListeners;
import com.willfp.ecobosses.bosses.listeners.AutoSpawnTimer; import com.willfp.ecobosses.bosses.listeners.AutoSpawnTimer;
import com.willfp.ecobosses.bosses.listeners.DeathListeners; import com.willfp.ecobosses.bosses.listeners.DeathListeners;
@@ -12,11 +9,9 @@ import com.willfp.ecobosses.bosses.listeners.PassiveListeners;
import com.willfp.ecobosses.bosses.listeners.SpawnListeners; import com.willfp.ecobosses.bosses.listeners.SpawnListeners;
import com.willfp.ecobosses.bosses.util.BossUtils; import com.willfp.ecobosses.bosses.util.BossUtils;
import com.willfp.ecobosses.commands.CommandEcobosses; import com.willfp.ecobosses.commands.CommandEcobosses;
import com.willfp.ecobosses.commands.CommandSpawn;
import lombok.Getter; import lombok.Getter;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@@ -36,89 +31,25 @@ public class EcoBossesPlugin extends EcoPlugin {
instance = this; instance = this;
} }
/**
* Code executed on plugin enable.
*/
@Override @Override
public void enable() { protected void handleDisable() {
this.getExtensionLoader().loadExtensions();
if (this.getExtensionLoader().getLoadedExtensions().isEmpty()) {
this.getLogger().info("&cNo extensions found");
} else {
this.getLogger().info("Extensions Loaded:");
this.getExtensionLoader().getLoadedExtensions().forEach(extension -> this.getLogger().info("- " + extension.getName() + " v" + extension.getVersion()));
}
}
/**
* Code executed on plugin disable.
*/
@Override
public void disable() {
this.getExtensionLoader().unloadExtensions();
BossUtils.killAllBosses(); BossUtils.killAllBosses();
} }
/**
* Nothing is called on plugin load.
*/
@Override @Override
public void load() { protected void handleReload() {
// Nothing needs to be called on load
}
/**
* Code executed on reload.
*/
@Override
public void onReload() {
this.getScheduler().runTimer(new AutoSpawnTimer(), 5, 1); this.getScheduler().runTimer(new AutoSpawnTimer(), 5, 1);
} }
/**
* Code executed after server is up.
*/
@Override @Override
public void postLoad() { protected List<PluginCommand> loadPluginCommands() {
// Nothing is executed post-load.
}
/**
* EcoEnchants-specific integrations.
*
* @return A list of all integrations.
*/
@Override
public List<IntegrationLoader> getIntegrationLoaders() {
return new ArrayList<>();
}
@Override
public List<PluginCommand> getPluginCommands() {
return Arrays.asList( return Arrays.asList(
new CommandEcobosses(this) new CommandEcobosses(this)
); );
} }
/**
* Packet Adapters for enchant display.
*
* @return A list of packet adapters.
*/
@Override @Override
public List<AbstractPacketAdapter> getPacketAdapters() { protected List<Listener> loadListeners() {
return new ArrayList<>();
}
/**
* EcoEnchants-specific listeners.
*
* @return A list of all listeners.
*/
@Override
public List<Listener> getListeners() {
return Arrays.asList( return Arrays.asList(
new AttackListeners(this), new AttackListeners(this),
new DeathListeners(this), new DeathListeners(this),
@@ -126,17 +57,4 @@ public class EcoBossesPlugin extends EcoPlugin {
new PassiveListeners(this) new PassiveListeners(this)
); );
} }
@Override
public List<Class<?>> getUpdatableClasses() {
return Arrays.asList(
EcoBosses.class,
CommandSpawn.class
);
}
@Override
protected String getMinimumEcoVersion() {
return "5.7.1";
}
} }

View File

@@ -3,7 +3,7 @@ package com.willfp.ecobosses.bosses;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.willfp.eco.core.EcoPlugin; import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.PluginDependent; import com.willfp.eco.core.PluginDependent;
import com.willfp.eco.core.config.Config; import com.willfp.eco.core.config.interfaces.Config;
import com.willfp.eco.core.tuples.Pair; import com.willfp.eco.core.tuples.Pair;
import com.willfp.eco.util.StringUtils; import com.willfp.eco.util.StringUtils;
import com.willfp.ecobosses.bosses.effects.Effect; import com.willfp.ecobosses.bosses.effects.Effect;
@@ -377,11 +377,11 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
// Messages // Messages
this.spawnMessages = new ArrayList<>(); this.spawnMessages = new ArrayList<>();
for (String string : this.getConfig().getStrings("broadcast.spawn")) { for (String string : this.getConfig().getStrings("broadcast.spawn")) {
this.spawnMessages.add(StringUtils.translate(string)); this.spawnMessages.add(StringUtils.format(string));
} }
this.deathMessages = new ArrayList<>(); this.deathMessages = new ArrayList<>();
for (String string : this.getConfig().getStrings("broadcast.death")) { for (String string : this.getConfig().getStrings("broadcast.death")) {
this.deathMessages.add(StringUtils.translate(string)); this.deathMessages.add(StringUtils.format(string));
} }
// Top Damager Commands // Top Damager Commands

View File

@@ -3,7 +3,7 @@ package com.willfp.ecobosses.bosses;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.willfp.eco.core.config.ConfigUpdater; import com.willfp.eco.core.config.updating.ConfigUpdater;
import com.willfp.ecobosses.EcoBossesPlugin; import com.willfp.ecobosses.EcoBossesPlugin;
import com.willfp.ecobosses.config.BaseBossConfig; import com.willfp.ecobosses.config.BaseBossConfig;
import com.willfp.ecobosses.config.CustomConfig; import com.willfp.ecobosses.config.CustomConfig;

View File

@@ -1,8 +1,8 @@
package com.willfp.ecobosses.bosses.util.bosstype; package com.willfp.ecobosses.bosses.util.bosstype;
import com.willfp.ecobosses.EcoBossesPlugin;
import com.willfp.ecobosses.proxy.proxies.CustomEntitySpawnerProxy; import com.willfp.ecobosses.proxy.proxies.CustomEntitySpawnerProxy;
import com.willfp.ecobosses.proxy.util.CustomEntity; import com.willfp.ecobosses.proxy.util.CustomEntity;
import com.willfp.ecobosses.util.ProxyUtils;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@@ -24,6 +24,6 @@ class CustomBossType extends BossType {
@Override @Override
public LivingEntity spawnBossEntity(@NotNull final Location location) { public LivingEntity spawnBossEntity(@NotNull final Location location) {
return ProxyUtils.getProxy(CustomEntitySpawnerProxy.class).spawnCustomEntity(entityClass, location); return EcoBossesPlugin.getInstance().getProxy(CustomEntitySpawnerProxy.class).spawnCustomEntity(entityClass, location);
} }
} }

View File

@@ -1,8 +1,6 @@
package com.willfp.ecobosses.bosses.util.obj; package com.willfp.ecobosses.bosses.util.obj;
import lombok.Getter;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.jetbrains.annotations.NotNull;
public record OptionedSound(Sound sound, public record OptionedSound(Sound sound,
float volume, float volume,

View File

@@ -1,10 +1,10 @@
package com.willfp.ecobosses.config; package com.willfp.ecobosses.config;
import com.willfp.eco.core.config.ExtendableConfig; import com.willfp.eco.core.config.yaml.YamlExtendableConfig;
import com.willfp.ecobosses.EcoBossesPlugin; import com.willfp.ecobosses.EcoBossesPlugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
public class BaseBossConfig extends ExtendableConfig { public class BaseBossConfig extends YamlExtendableConfig {
/** /**
* Create new EcoBoss config. * Create new EcoBoss config.
* *

View File

@@ -1,6 +1,6 @@
package com.willfp.ecobosses.config; package com.willfp.ecobosses.config;
import com.willfp.eco.core.config.YamlConfig; import com.willfp.eco.core.config.yaml.YamlConfig;
import lombok.Getter; import lombok.Getter;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;

View File

@@ -1,21 +0,0 @@
package com.willfp.ecobosses.util;
import com.willfp.eco.core.proxy.AbstractProxy;
import com.willfp.ecobosses.EcoBossesPlugin;
import com.willfp.ecobosses.proxy.util.ProxyFactory;
import lombok.experimental.UtilityClass;
import org.jetbrains.annotations.NotNull;
@UtilityClass
public class ProxyUtils {
/**
* Get the implementation of a specified proxy.
*
* @param proxyClass The proxy interface.
* @param <T> The type of the proxy.
* @return The proxy implementation.
*/
public @NotNull <T extends AbstractProxy> T getProxy(@NotNull final Class<T> proxyClass) {
return new ProxyFactory<>(EcoBossesPlugin.getInstance(), proxyClass).getProxy();
}
}

View File

@@ -1,2 +1,2 @@
version = 5.3.0 version = 6.0.0
plugin-name = EcoBosses plugin-name = EcoBosses

Binary file not shown.

Binary file not shown.