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