9
0
mirror of https://github.com/Auxilor/EcoArmor.git synced 2025-12-27 19:09:13 +00:00

Added more to meta

This commit is contained in:
Auxilor
2021-06-24 14:33:18 +01:00
parent fe15256678
commit dc7ed33108

View File

@@ -5,9 +5,14 @@ import com.willfp.eco.core.command.AbstractCommand;
import com.willfp.eco.core.config.JSONConfig;
import com.willfp.eco.core.web.Paste;
import com.willfp.ecoarmor.EcoArmorPlugin;
import com.willfp.ecoarmor.conditions.Condition;
import com.willfp.ecoarmor.conditions.Conditions;
import com.willfp.ecoarmor.effects.Effect;
import com.willfp.ecoarmor.effects.Effects;
import org.bukkit.NamespacedKey;
import org.bukkit.command.CommandSender;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.potion.PotionEffectType;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
@@ -30,9 +35,20 @@ public class CommandEaeditor extends AbstractCommand {
public void onExecute(@NotNull final CommandSender sender,
@NotNull final List<String> args) {
JSONConfig config = ((EcoArmorPlugin) this.getPlugin()).getEcoArmorJson().clone();
List<String> enchantKeys = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList());
Map<String, Object> meta = new HashMap<>();
meta.put("enchants", enchantKeys);
List<String> enchants = Arrays.stream(Enchantment.values()).map(Enchantment::getKey).map(NamespacedKey::getKey).collect(Collectors.toList());
meta.put("enchants", enchants);
List<String> potionEffects = Arrays.stream(PotionEffectType.values()).map(PotionEffectType::getName).collect(Collectors.toList());
meta.put("potion-effects", potionEffects);
List<String> effects = Effects.values().stream().map(Effect::getName).collect(Collectors.toList());
meta.put("effects", effects);
List<String> conditions = Conditions.values().stream().map(Condition::getName).collect(Collectors.toList());
meta.put("conditions", conditions);
config.set("meta", meta);
String token = new Paste(config.toPlaintext()).getHastebinToken();
String message = this.getPlugin().getLangYml().getMessage("open-editor")