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

Updated eco

This commit is contained in:
Auxilor
2022-01-06 18:53:42 +00:00
parent c4a04ed048
commit ab23e19804
9 changed files with 213 additions and 216 deletions

View File

@@ -47,7 +47,7 @@ allprojects {
}
dependencies {
compileOnly 'com.willfp:eco:6.9.0'
compileOnly 'com.willfp:eco:6.17.1'
compileOnly 'org.jetbrains:annotations:19.0.0'

View File

@@ -500,15 +500,15 @@ public class EcoBoss extends PluginDependent<EcoPlugin> {
// Messages
this.spawnMessages = new ArrayList<>();
for (String string : this.getConfig().getStrings("broadcast.spawn")) {
for (String string : this.getConfig().getFormattedStrings("broadcast.spawn")) {
this.spawnMessages.add(StringUtils.format(string));
}
this.deathMessages = new ArrayList<>();
for (String string : this.getConfig().getStrings("broadcast.death")) {
for (String string : this.getConfig().getFormattedStrings("broadcast.death")) {
this.deathMessages.add(StringUtils.format(string));
}
this.despawnMessages = new ArrayList<>();
for (String string : this.getConfig().getStrings("broadcast.despawn")) {
for (String string : this.getConfig().getFormattedStrings("broadcast.despawn")) {
this.despawnMessages.add(StringUtils.format(string));
}

View File

@@ -1,10 +1,12 @@
package com.willfp.ecobosses.commands;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.impl.PluginCommand;
import com.willfp.ecobosses.EcoBossesPlugin;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class CommandEcobosses extends PluginCommand {
/**
* Instantiate a new executor for /ebdrop.
@@ -20,9 +22,8 @@ public class CommandEcobosses extends PluginCommand {
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-command"));
};
}
}

View File

@@ -2,13 +2,12 @@ package com.willfp.ecobosses.commands;
import com.willfp.eco.core.EcoPlugin;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.TabCompleteHandler;
import com.willfp.eco.core.command.impl.Subcommand;
import com.willfp.eco.core.config.updating.ConfigUpdater;
import com.willfp.ecobosses.bosses.EcoBoss;
import com.willfp.ecobosses.bosses.EcoBosses;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.StringUtil;
@@ -62,8 +61,8 @@ public class CommandGive extends Subcommand {
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
if (args.isEmpty()) {
sender.sendMessage(this.getPlugin().getLangYml().getMessage("needs-player"));
return;
@@ -108,12 +107,11 @@ public class CommandGive extends Subcommand {
ItemStack itemStack = boss.getSpawnEgg();
itemStack.setAmount(amount);
reciever.getInventory().addItem(itemStack);
};
}
@Override
public TabCompleteHandler getTabCompleter() {
return (sender, args) -> {
public List<String> tabComplete(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
List<String> completions = new ArrayList<>();
if (args.isEmpty()) {
@@ -146,6 +144,5 @@ public class CommandGive extends Subcommand {
}
return new ArrayList<>(0);
};
}
}

View File

@@ -1,11 +1,13 @@
package com.willfp.ecobosses.commands;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.impl.Subcommand;
import com.willfp.ecobosses.EcoBossesPlugin;
import com.willfp.ecobosses.bosses.util.BossUtils;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class CommandKillall extends Subcommand {
/**
* Instantiate a new executor for /ebspawn.
@@ -17,14 +19,13 @@ public class CommandKillall extends Subcommand {
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
boolean force = false;
if (args.size() == 1) {
force = args.get(0).equalsIgnoreCase("force");
}
sender.sendMessage(this.getPlugin().getLangYml().getMessage("killall").replace("%amount%", String.valueOf(BossUtils.killAllBosses(force))));
};
}
}

View File

@@ -1,10 +1,12 @@
package com.willfp.ecobosses.commands;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.impl.Subcommand;
import com.willfp.ecobosses.EcoBossesPlugin;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class CommandReload extends Subcommand {
/**
* Instantiate a new executor for /ebreload.
@@ -16,11 +18,10 @@ public class CommandReload extends Subcommand {
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
this.getPlugin().reload();
this.getPlugin().reload();
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
};
}
}

View File

@@ -1,7 +1,5 @@
package com.willfp.ecobosses.commands;
import com.willfp.eco.core.command.CommandHandler;
import com.willfp.eco.core.command.TabCompleteHandler;
import com.willfp.eco.core.command.impl.Subcommand;
import com.willfp.eco.core.config.updating.ConfigUpdater;
import com.willfp.ecobosses.EcoBossesPlugin;
@@ -10,6 +8,7 @@ import com.willfp.ecobosses.bosses.EcoBosses;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import org.jetbrains.annotations.NotNull;
@@ -53,8 +52,8 @@ public class CommandSpawn extends Subcommand {
}
@Override
public CommandHandler getHandler() {
return (sender, args) -> {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
if (args.isEmpty()) {
sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-boss"));
return;
@@ -155,13 +154,11 @@ public class CommandSpawn extends Subcommand {
boss.spawn(location);
sender.sendMessage(this.getPlugin().getLangYml().getMessage("spawned"));
};
}
@Override
public TabCompleteHandler getTabCompleter() {
return (sender, args) -> {
public List<String> tabComplete(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
List<String> completions = new ArrayList<>();
if (args.isEmpty()) {
@@ -205,6 +202,5 @@ public class CommandSpawn extends Subcommand {
}
return new ArrayList<>(0);
};
}
}

View File

@@ -1,16 +1,17 @@
package com.willfp.ecobosses.config;
import com.willfp.eco.core.config.yaml.YamlExtendableConfig;
import com.willfp.eco.core.config.ConfigType;
import com.willfp.eco.core.config.ExtendableConfig;
import com.willfp.ecobosses.EcoBossesPlugin;
import org.jetbrains.annotations.NotNull;
public class BaseBossConfig extends YamlExtendableConfig {
public class BaseBossConfig extends ExtendableConfig {
/**
* Create new EcoBoss config.
*
* @param configName The name of the config.
*/
public BaseBossConfig(@NotNull final String configName) {
super(configName, true, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/");
super(configName, true, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/", ConfigType.YAML);
}
}

View File

@@ -1,11 +1,11 @@
package com.willfp.ecobosses.config;
import com.willfp.eco.core.config.yaml.YamlTransientConfig;
import com.willfp.eco.core.config.TransientConfig;
import lombok.Getter;
import org.bukkit.configuration.file.YamlConfiguration;
import org.jetbrains.annotations.NotNull;
public class CustomConfig extends YamlTransientConfig {
public class CustomConfig extends TransientConfig {
/**
* The name of the config.
*/