mirror of
https://github.com/Auxilor/EcoArmor.git
synced 2025-12-27 19:09:13 +00:00
Added more options to eagive
This commit is contained in:
@@ -67,8 +67,33 @@ public class CommandEagive extends AbstractCommand {
|
||||
String message = this.getPlugin().getLangYml().getMessage("give-success");
|
||||
message = message.replace("%item%", set.getName() + " Set").replace("%recipient%", reciever.getName());
|
||||
sender.sendMessage(message);
|
||||
|
||||
boolean advanced = false;
|
||||
if (args.size() >= 4) {
|
||||
advanced = Boolean.parseBoolean(args.get(3));
|
||||
}
|
||||
|
||||
if (args.size() >= 3) {
|
||||
ArmorSlot slot = ArmorSlot.getSlot(args.get(2));
|
||||
|
||||
if (slot == null) {
|
||||
sender.sendMessage(this.getPlugin().getLangYml().getMessage("invalid-item"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
reciever.getInventory().addItem(set.getAdvancedItemStack(slot));
|
||||
} else {
|
||||
reciever.getInventory().addItem(set.getItemStack(slot));
|
||||
}
|
||||
}
|
||||
|
||||
for (ArmorSlot slot : ArmorSlot.values()) {
|
||||
reciever.getInventory().addItem(set.getItemStack(slot));
|
||||
if (advanced) {
|
||||
reciever.getInventory().addItem(set.getAdvancedItemStack(slot));
|
||||
} else {
|
||||
reciever.getInventory().addItem(set.getItemStack(slot));
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.willfp.eco.util.command.AbstractCommand;
|
||||
import com.willfp.eco.util.command.AbstractTabCompleter;
|
||||
import com.willfp.eco.util.config.updating.annotations.ConfigUpdater;
|
||||
import com.willfp.ecoarmor.sets.ArmorSets;
|
||||
import com.willfp.ecoarmor.sets.meta.ArmorSlot;
|
||||
import com.willfp.ecoarmor.upgrades.crystal.UpgradeCrystal;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@@ -12,6 +13,7 @@ import org.bukkit.util.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -71,6 +73,20 @@ public class TabcompleterEagive extends AbstractTabCompleter {
|
||||
return completions;
|
||||
}
|
||||
|
||||
if (args.size() == 3) {
|
||||
StringUtil.copyPartialMatches(args.get(2), Arrays.stream(ArmorSlot.values()).map(slot -> slot.name().toLowerCase()).collect(Collectors.toList()), completions);
|
||||
|
||||
Collections.sort(completions);
|
||||
return completions;
|
||||
}
|
||||
|
||||
if (args.size() == 4) {
|
||||
StringUtil.copyPartialMatches(args.get(3), Arrays.asList("true", "false"), completions);
|
||||
|
||||
Collections.sort(completions);
|
||||
return completions;
|
||||
}
|
||||
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +76,35 @@ public enum ArmorSlot {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ArmorSlot from name.
|
||||
*
|
||||
* @param name The name.
|
||||
* @return The slot, or null.
|
||||
*/
|
||||
@Nullable
|
||||
public static ArmorSlot getSlot(@NotNull final String name) {
|
||||
if (name.equalsIgnoreCase("helmet")) {
|
||||
return HELMET;
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("chestplate")) {
|
||||
return CHESTPLATE;
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("elytra")) {
|
||||
return ELYTRA;
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("leggings")) {
|
||||
return LEGGINGS;
|
||||
}
|
||||
|
||||
if (name.equalsIgnoreCase("boots")) {
|
||||
return BOOTS;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ Reaper:
|
||||
- prismarine_shard
|
||||
|
||||
- ecoarmor:set_reaper_chestplate
|
||||
- ecoarmor:upgrade_crystal_manyullyn
|
||||
- nether_star
|
||||
- ecoarmor:set_reaper_leggings
|
||||
|
||||
- prismarine_shard
|
||||
|
||||
Reference in New Issue
Block a user