mirror of
https://github.com/Auxilor/EcoMobs.git
synced 2025-12-20 15:39:31 +00:00
Updated eco
This commit is contained in:
@@ -47,7 +47,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly 'com.willfp:eco:6.9.0'
|
compileOnly 'com.willfp:eco:6.17.1'
|
||||||
|
|
||||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||||
|
|
||||||
|
|||||||
@@ -500,15 +500,15 @@ 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().getFormattedStrings("broadcast.spawn")) {
|
||||||
this.spawnMessages.add(StringUtils.format(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().getFormattedStrings("broadcast.death")) {
|
||||||
this.deathMessages.add(StringUtils.format(string));
|
this.deathMessages.add(StringUtils.format(string));
|
||||||
}
|
}
|
||||||
this.despawnMessages = new ArrayList<>();
|
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));
|
this.despawnMessages.add(StringUtils.format(string));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.willfp.ecobosses.commands;
|
package com.willfp.ecobosses.commands;
|
||||||
|
|
||||||
import com.willfp.eco.core.command.CommandHandler;
|
|
||||||
import com.willfp.eco.core.command.impl.PluginCommand;
|
import com.willfp.eco.core.command.impl.PluginCommand;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandEcobosses extends PluginCommand {
|
public class CommandEcobosses extends PluginCommand {
|
||||||
/**
|
/**
|
||||||
* Instantiate a new executor for /ebdrop.
|
* Instantiate a new executor for /ebdrop.
|
||||||
@@ -20,9 +22,8 @@ public class CommandEcobosses extends PluginCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandHandler getHandler() {
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-command"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-command"));
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,12 @@ package com.willfp.ecobosses.commands;
|
|||||||
|
|
||||||
|
|
||||||
import com.willfp.eco.core.EcoPlugin;
|
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.command.impl.Subcommand;
|
||||||
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||||
import com.willfp.ecobosses.bosses.EcoBoss;
|
import com.willfp.ecobosses.bosses.EcoBoss;
|
||||||
import com.willfp.ecobosses.bosses.EcoBosses;
|
import com.willfp.ecobosses.bosses.EcoBosses;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
@@ -62,90 +61,88 @@ public class CommandGive extends Subcommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandHandler getHandler() {
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("needs-player"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("needs-player"));
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.size() == 1) {
|
||||||
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("needs-boss"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int amount = 1;
|
||||||
|
|
||||||
|
if (args.size() > 2) {
|
||||||
|
try {
|
||||||
|
amount = Integer.parseInt(args.get(2));
|
||||||
|
} catch (NumberFormatException ignored) {
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (args.size() == 1) {
|
String recieverName = args.get(0);
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("needs-boss"));
|
Player reciever = Bukkit.getPlayer(recieverName);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amount = 1;
|
if (reciever == null) {
|
||||||
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.size() > 2) {
|
String key = args.get(1);
|
||||||
try {
|
|
||||||
amount = Integer.parseInt(args.get(2));
|
|
||||||
} catch (NumberFormatException ignored) {
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String recieverName = args.get(0);
|
EcoBoss boss = EcoBosses.getByName(key);
|
||||||
Player reciever = Bukkit.getPlayer(recieverName);
|
|
||||||
|
|
||||||
if (reciever == null) {
|
if (boss == null || boss.getSpawnEgg() == null) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-player"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-boss"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String key = args.get(1);
|
String message = this.getPlugin().getLangYml().getMessage("give-success");
|
||||||
|
message = message.replace("%boss%", boss.getName()).replace("%recipient%", reciever.getName());
|
||||||
|
sender.sendMessage(message);
|
||||||
|
|
||||||
EcoBoss boss = EcoBosses.getByName(key);
|
ItemStack itemStack = boss.getSpawnEgg();
|
||||||
|
itemStack.setAmount(amount);
|
||||||
if (boss == null || boss.getSpawnEgg() == null) {
|
reciever.getInventory().addItem(itemStack);
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-boss"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String message = this.getPlugin().getLangYml().getMessage("give-success");
|
|
||||||
message = message.replace("%boss%", boss.getName()).replace("%recipient%", reciever.getName());
|
|
||||||
sender.sendMessage(message);
|
|
||||||
|
|
||||||
ItemStack itemStack = boss.getSpawnEgg();
|
|
||||||
itemStack.setAmount(amount);
|
|
||||||
reciever.getInventory().addItem(itemStack);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TabCompleteHandler getTabCompleter() {
|
public List<String> tabComplete(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
List<String> completions = new ArrayList<>();
|
List<String> completions = new ArrayList<>();
|
||||||
|
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
// Currently, this case is not ever reached
|
// Currently, this case is not ever reached
|
||||||
return BOSS_NAMES;
|
return BOSS_NAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
StringUtil.copyPartialMatches(args.get(0), Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()), completions);
|
StringUtil.copyPartialMatches(args.get(0), Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()), completions);
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() == 2) {
|
if (args.size() == 2) {
|
||||||
StringUtil.copyPartialMatches(args.get(1), BOSS_NAMES, completions);
|
StringUtil.copyPartialMatches(args.get(1), BOSS_NAMES, completions);
|
||||||
|
|
||||||
Collections.sort(completions);
|
Collections.sort(completions);
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() == 3) {
|
if (args.size() == 3) {
|
||||||
StringUtil.copyPartialMatches(args.get(2), NUMBERS, completions);
|
StringUtil.copyPartialMatches(args.get(2), NUMBERS, completions);
|
||||||
|
|
||||||
completions.sort((s1, s2) -> {
|
completions.sort((s1, s2) -> {
|
||||||
int t1 = Integer.parseInt(s1);
|
int t1 = Integer.parseInt(s1);
|
||||||
int t2 = Integer.parseInt(s2);
|
int t2 = Integer.parseInt(s2);
|
||||||
return t1 - t2;
|
return t1 - t2;
|
||||||
});
|
});
|
||||||
|
|
||||||
return completions;
|
return completions;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.willfp.ecobosses.commands;
|
package com.willfp.ecobosses.commands;
|
||||||
|
|
||||||
import com.willfp.eco.core.command.CommandHandler;
|
|
||||||
import com.willfp.eco.core.command.impl.Subcommand;
|
import com.willfp.eco.core.command.impl.Subcommand;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
import com.willfp.ecobosses.bosses.util.BossUtils;
|
import com.willfp.ecobosses.bosses.util.BossUtils;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandKillall extends Subcommand {
|
public class CommandKillall extends Subcommand {
|
||||||
/**
|
/**
|
||||||
* Instantiate a new executor for /ebspawn.
|
* Instantiate a new executor for /ebspawn.
|
||||||
@@ -17,14 +19,13 @@ public class CommandKillall extends Subcommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandHandler getHandler() {
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
boolean force = false;
|
boolean force = false;
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
force = args.get(0).equalsIgnoreCase("force");
|
force = args.get(0).equalsIgnoreCase("force");
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("killall").replace("%amount%", String.valueOf(BossUtils.killAllBosses(force))));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("killall").replace("%amount%", String.valueOf(BossUtils.killAllBosses(force))));
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.willfp.ecobosses.commands;
|
package com.willfp.ecobosses.commands;
|
||||||
|
|
||||||
import com.willfp.eco.core.command.CommandHandler;
|
|
||||||
import com.willfp.eco.core.command.impl.Subcommand;
|
import com.willfp.eco.core.command.impl.Subcommand;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class CommandReload extends Subcommand {
|
public class CommandReload extends Subcommand {
|
||||||
/**
|
/**
|
||||||
* Instantiate a new executor for /ebreload.
|
* Instantiate a new executor for /ebreload.
|
||||||
@@ -16,11 +18,10 @@ public class CommandReload extends Subcommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandHandler getHandler() {
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
this.getPlugin().reload();
|
this.getPlugin().reload();
|
||||||
this.getPlugin().reload();
|
this.getPlugin().reload();
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("reloaded"));
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
package com.willfp.ecobosses.commands;
|
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.command.impl.Subcommand;
|
||||||
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||||
import com.willfp.ecobosses.EcoBossesPlugin;
|
import com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
@@ -10,6 +8,7 @@ import com.willfp.ecobosses.bosses.EcoBosses;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -53,158 +52,155 @@ public class CommandSpawn extends Subcommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandHandler getHandler() {
|
public void onExecute(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
if (args.isEmpty()) {
|
if (args.isEmpty()) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-boss"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-boss"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String bossName = args.get(0);
|
String bossName = args.get(0);
|
||||||
|
|
||||||
EcoBoss boss = EcoBosses.getByName(bossName.toLowerCase());
|
EcoBoss boss = EcoBosses.getByName(bossName.toLowerCase());
|
||||||
|
|
||||||
if (boss == null) {
|
if (boss == null) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-boss"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("specify-boss"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location location = null;
|
Location location = null;
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
location = ((Player) sender).getLocation();
|
location = ((Player) sender).getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.size() >= 4) {
|
if (args.size() >= 4) {
|
||||||
String xString = args.get(1);
|
String xString = args.get(1);
|
||||||
String yString = args.get(2);
|
String yString = args.get(2);
|
||||||
String zString = args.get(3);
|
String zString = args.get(3);
|
||||||
|
|
||||||
double xPos;
|
double xPos;
|
||||||
double yPos;
|
double yPos;
|
||||||
double zPos;
|
double zPos;
|
||||||
|
|
||||||
if (xString.startsWith("~") && sender instanceof Player) {
|
if (xString.startsWith("~") && sender instanceof Player) {
|
||||||
String xDiff = xString.replace("~", "");
|
String xDiff = xString.replace("~", "");
|
||||||
String yDiff = yString.replace("~", "");
|
String yDiff = yString.replace("~", "");
|
||||||
String zDiff = zString.replace("~", "");
|
String zDiff = zString.replace("~", "");
|
||||||
|
|
||||||
if (xDiff.isEmpty()) {
|
if (xDiff.isEmpty()) {
|
||||||
xPos = ((Player) sender).getLocation().getX();
|
xPos = ((Player) sender).getLocation().getX();
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
xPos = ((Player) sender).getLocation().getX() + Double.parseDouble(xDiff);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
xPos = ((Player) sender).getLocation().getX();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yDiff.isEmpty()) {
|
|
||||||
yPos = ((Player) sender).getLocation().getY();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
yPos = ((Player) sender).getLocation().getY() + Double.parseDouble(yDiff);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
yPos = ((Player) sender).getLocation().getY();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (zDiff.isEmpty()) {
|
|
||||||
zPos = ((Player) sender).getLocation().getZ();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
zPos = ((Player) sender).getLocation().getZ() + Double.parseDouble(yDiff);
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
zPos = ((Player) sender).getLocation().getZ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
xPos = Double.parseDouble(xString);
|
xPos = ((Player) sender).getLocation().getX() + Double.parseDouble(xDiff);
|
||||||
yPos = Double.parseDouble(yString);
|
|
||||||
zPos = Double.parseDouble(zString);
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-location"));
|
xPos = ((Player) sender).getLocation().getX();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
location = new Location(null, xPos, yPos, zPos);
|
if (yDiff.isEmpty()) {
|
||||||
|
yPos = ((Player) sender).getLocation().getY();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
yPos = ((Player) sender).getLocation().getY() + Double.parseDouble(yDiff);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
yPos = ((Player) sender).getLocation().getY();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zDiff.isEmpty()) {
|
||||||
|
zPos = ((Player) sender).getLocation().getZ();
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
zPos = ((Player) sender).getLocation().getZ() + Double.parseDouble(yDiff);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
zPos = ((Player) sender).getLocation().getZ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
xPos = Double.parseDouble(xString);
|
||||||
|
yPos = Double.parseDouble(yString);
|
||||||
|
zPos = Double.parseDouble(zString);
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-location"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
World world = null;
|
location = new Location(null, xPos, yPos, zPos);
|
||||||
if (sender instanceof Player) {
|
}
|
||||||
world = ((Player) sender).getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() >= 5) {
|
World world = null;
|
||||||
world = Bukkit.getWorld(args.get(4));
|
if (sender instanceof Player) {
|
||||||
}
|
world = ((Player) sender).getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
if (location == null) {
|
if (args.size() >= 5) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-location"));
|
world = Bukkit.getWorld(args.get(4));
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
location.setWorld(world);
|
if (location == null) {
|
||||||
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-location"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (world == null) {
|
location.setWorld(world);
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-world"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boss.spawn(location);
|
if (world == null) {
|
||||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("spawned"));
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-world"));
|
||||||
};
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boss.spawn(location);
|
||||||
|
sender.sendMessage(this.getPlugin().getLangYml().getMessage("spawned"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TabCompleteHandler getTabCompleter() {
|
public List<String> tabComplete(@NotNull final CommandSender sender,
|
||||||
return (sender, args) -> {
|
@NotNull final List<String> args) {
|
||||||
|
List<String> completions = new ArrayList<>();
|
||||||
|
|
||||||
List<String> completions = new ArrayList<>();
|
if (args.isEmpty()) {
|
||||||
|
// Currently, this case is not ever reached
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
if (args.isEmpty()) {
|
if (args.size() == 1) {
|
||||||
// Currently, this case is not ever reached
|
StringUtil.copyPartialMatches(args.get(0), BOSS_NAMES, completions);
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 1) {
|
Collections.sort(completions);
|
||||||
StringUtil.copyPartialMatches(args.get(0), BOSS_NAMES, completions);
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(completions);
|
if (args.size() == 2) {
|
||||||
return completions;
|
StringUtil.copyPartialMatches(args.get(1), TILDE, completions);
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 2) {
|
Collections.sort(completions);
|
||||||
StringUtil.copyPartialMatches(args.get(1), TILDE, completions);
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(completions);
|
if (args.size() == 3) {
|
||||||
return completions;
|
StringUtil.copyPartialMatches(args.get(2), TILDE, completions);
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 3) {
|
Collections.sort(completions);
|
||||||
StringUtil.copyPartialMatches(args.get(2), TILDE, completions);
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(completions);
|
if (args.size() == 4) {
|
||||||
return completions;
|
StringUtil.copyPartialMatches(args.get(3), TILDE, completions);
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 4) {
|
Collections.sort(completions);
|
||||||
StringUtil.copyPartialMatches(args.get(3), TILDE, completions);
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(completions);
|
if (args.size() == 5) {
|
||||||
return completions;
|
StringUtil.copyPartialMatches(args.get(4), Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList()), completions);
|
||||||
}
|
|
||||||
|
|
||||||
if (args.size() == 5) {
|
Collections.sort(completions);
|
||||||
StringUtil.copyPartialMatches(args.get(4), Bukkit.getWorlds().stream().map(World::getName).collect(Collectors.toList()), completions);
|
return completions;
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(completions);
|
return new ArrayList<>(0);
|
||||||
return completions;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ArrayList<>(0);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
package com.willfp.ecobosses.config;
|
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 com.willfp.ecobosses.EcoBossesPlugin;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class BaseBossConfig extends YamlExtendableConfig {
|
public class BaseBossConfig extends ExtendableConfig {
|
||||||
/**
|
/**
|
||||||
* Create new EcoBoss config.
|
* Create new EcoBoss config.
|
||||||
*
|
*
|
||||||
* @param configName The name of the config.
|
* @param configName The name of the config.
|
||||||
*/
|
*/
|
||||||
public BaseBossConfig(@NotNull final String configName) {
|
public BaseBossConfig(@NotNull final String configName) {
|
||||||
super(configName, true, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/");
|
super(configName, true, EcoBossesPlugin.getInstance(), EcoBossesPlugin.class, "bosses/", ConfigType.YAML);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.willfp.ecobosses.config;
|
package com.willfp.ecobosses.config;
|
||||||
|
|
||||||
import com.willfp.eco.core.config.yaml.YamlTransientConfig;
|
import com.willfp.eco.core.config.TransientConfig;
|
||||||
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;
|
||||||
|
|
||||||
public class CustomConfig extends YamlTransientConfig {
|
public class CustomConfig extends TransientConfig {
|
||||||
/**
|
/**
|
||||||
* The name of the config.
|
* The name of the config.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user