Added reload for TabCompleterEnchantinfo

This commit is contained in:
Auxilor
2020-10-18 20:07:28 +01:00
parent f19b7d73f9
commit ec61350b94
2 changed files with 9 additions and 7 deletions

View File

@@ -14,11 +14,15 @@ import java.util.List;
import java.util.stream.Collectors;
public class TabCompleterEnchantinfo extends AbstractTabCompleter {
private final List<String> enchantsNames;
private static final List<String> enchantsNames = EcoEnchants.getAll().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList());
public TabCompleterEnchantinfo() {
super((AbstractCommand) Bukkit.getPluginCommand("enchantinfo").getExecutor());
enchantsNames = EcoEnchants.getAll().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList());
}
public static void reload() {
enchantsNames.clear();
enchantsNames.addAll(EcoEnchants.getAll().stream().filter(EcoEnchant::isEnabled).map(EcoEnchant::getName).collect(Collectors.toList()));
}
private static String removePrefix(String s, String prefix) {

View File

@@ -5,6 +5,7 @@ import com.willfp.ecoenchants.EcoEnchantsPlugin;
import com.willfp.ecoenchants.command.commands.CommandEcodebug;
import com.willfp.ecoenchants.command.commands.CommandEcoreload;
import com.willfp.ecoenchants.command.commands.CommandEnchantinfo;
import com.willfp.ecoenchants.command.tabcompleters.TabCompleterEnchantinfo;
import com.willfp.ecoenchants.config.ConfigManager;
import com.willfp.ecoenchants.display.EnchantDisplay;
import com.willfp.ecoenchants.display.packets.PacketOpenWindowMerchant;
@@ -32,11 +33,7 @@ import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatMatrix;
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatNCP;
import com.willfp.ecoenchants.integrations.anticheat.plugins.AnticheatSpartan;
import com.willfp.ecoenchants.integrations.antigrief.AntigriefManager;
import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefFactionsUUID;
import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefGriefPrevention;
import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefLands;
import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefTowny;
import com.willfp.ecoenchants.integrations.antigrief.plugins.AntigriefWorldGuard;
import com.willfp.ecoenchants.integrations.antigrief.plugins.*;
import com.willfp.ecoenchants.integrations.essentials.EssentialsManager;
import com.willfp.ecoenchants.integrations.essentials.plugins.IntegrationEssentials;
import com.willfp.ecoenchants.listeners.ArrowListeners;
@@ -441,6 +438,7 @@ public class Loader {
EnchantmentTarget.update();
EcoEnchants.update();
EnchantDisplay.update();
TabCompleterEnchantinfo.reload();
EcoEnchants.getAll().forEach((ecoEnchant -> {
HandlerList.unregisterAll(ecoEnchant);