Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d786014cbc | ||
|
|
b62bb48bb6 | ||
|
|
b238a10209 | ||
|
|
251049f1f1 | ||
|
|
16d146dba0 |
@@ -29,10 +29,10 @@ public class ArrowUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!(values.get(0) instanceof ItemStack)) {
|
||||
if (!(values.get(0).value() instanceof ItemStack)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (ItemStack) values.get(0);
|
||||
return (ItemStack) values.get(0).value();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,14 @@ public class EcoLoadableJSONConfig extends EcoJSONConfigWrapper implements Loada
|
||||
plugin.getConfigHandler().addConfig(this);
|
||||
}
|
||||
|
||||
public void reloadFromFile() {
|
||||
try {
|
||||
init(this.configFile);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createFile() {
|
||||
String resourcePath = getResourcePath();
|
||||
|
||||
@@ -5,7 +5,9 @@ import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.config.interfaces.LoadableConfig;
|
||||
import com.willfp.eco.core.config.updating.ConfigHandler;
|
||||
import com.willfp.eco.core.config.updating.ConfigUpdater;
|
||||
import com.willfp.eco.internal.config.json.EcoLoadableJSONConfig;
|
||||
import com.willfp.eco.internal.config.updating.exceptions.InvalidUpdateMethodException;
|
||||
import com.willfp.eco.internal.config.yaml.EcoLoadableYamlConfig;
|
||||
import com.willfp.eco.internal.config.yaml.EcoUpdatableYamlConfig;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.reflections.Reflections;
|
||||
@@ -76,6 +78,12 @@ public class EcoConfigHandler extends PluginDependent<EcoPlugin> implements Conf
|
||||
if (config instanceof EcoUpdatableYamlConfig updatableYamlConfig) {
|
||||
updatableYamlConfig.update();
|
||||
}
|
||||
if (config instanceof EcoLoadableYamlConfig ecoLoadableYamlConfig) {
|
||||
ecoLoadableYamlConfig.reloadFromFile();
|
||||
}
|
||||
if (config instanceof EcoLoadableJSONConfig ecoLoadableJSONConfig) {
|
||||
ecoLoadableJSONConfig.reloadFromFile();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.willfp.eco.core.config.interfaces.LoadableConfig;
|
||||
import com.willfp.eco.core.config.interfaces.WrappedYamlConfiguration;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -49,9 +50,19 @@ public class EcoLoadableYamlConfig extends EcoYamlConfigWrapper<YamlConfiguratio
|
||||
}
|
||||
|
||||
this.configFile = new File(directory, this.name);
|
||||
|
||||
this.getPlugin().getConfigHandler().addConfig(this);
|
||||
init(YamlConfiguration.loadConfiguration(configFile));
|
||||
}
|
||||
|
||||
public void reloadFromFile() {
|
||||
try {
|
||||
this.getHandle().load(this.getConfigFile());
|
||||
} catch (IOException | InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createFile() {
|
||||
String resourcePath = getResourcePath();
|
||||
|
||||
@@ -30,6 +30,8 @@ public class EcoUpdatableYamlConfig extends EcoLoadableYamlConfig {
|
||||
this.updateBlacklist = new ArrayList<>(Arrays.asList(updateBlacklist));
|
||||
this.updateBlacklist.removeIf(String::isEmpty);
|
||||
|
||||
plugin.getConfigHandler().addConfig(this);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
version = 6.0.2
|
||||
version = 6.0.4
|
||||
plugin-name = eco
|
||||
Reference in New Issue
Block a user