3
0
Mirror von https://github.com/St3venAU/ArmorStandTools.git synchronisiert 2024-12-28 04:20:08 +01:00

Update Config.java

Dieser Commit ist enthalten in:
Corentin Boiteau 2019-11-17 16:53:19 +01:00 committet von GitHub
Ursprung bf549ee223
Commit 0d501817eb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -1,18 +1,23 @@
package com.gmail.St3venAU.plugins.ArmorStandTools;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import org.bukkit.Material;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.PluginCommandYamlParser;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
class Config {
private static Main plugin;
@ -37,6 +42,7 @@ class Config {
static boolean requireCreative = false;
static int defaultASCmdCooldownTicks = 0;
static boolean ignoreWGForASCmdExecution = false;
static List<String> commandsBlocked = new ArrayList<String>();
static String
invReturned, asDropped, asVisible, isTrue, isFalse,
@ -51,7 +57,7 @@ class Config {
assignedCmdToAS, assignCmdError, ascmdHelp, viewCmd,
removeCmd, assignConsole, assignPlayer, executeCmdError,
cmdOnCooldown, cooldownRemovedFrom, isAnInvalidCooldown,
cooldownSetTo, ticksFor, setCooldown, removeCooldown;
cooldownSetTo, ticksFor, setCooldown, removeCooldown, commandBlocked;
static void reload(Main main) {
plugin = main;
@ -122,6 +128,7 @@ class Config {
ticksFor = languageConfig.getString("ticksFor");
setCooldown = languageConfig.getString("setCooldown");
ticksFor = languageConfig.getString("ticksFor");
commandBlocked = languageConfig.getString("commandBlocked");
}
private static void reloadMainConfig() {
@ -150,6 +157,20 @@ class Config {
debug = config.getBoolean("debug", false);
plugin.carryingArmorStand.clear();
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
for (String blocked : config.getStringList("commandBlocked")) {
for (Plugin plugin : plugin.getServer().getPluginManager().getPlugins()) {
command: for (Command command : PluginCommandYamlParser.parse(plugin)) {
if (command.getAliases().contains(blocked)) {
commandsBlocked.addAll(command.getAliases());
break command;
}
}
}
commandsBlocked.add(blocked);
}});
for(ArmorStandTool tool : ArmorStandTool.values()) {
tool.setEnabled(config);
}