mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
Fix api initial issue. (#15)
- Deleted object will now not be re added by default. - Config Event is now also triggered on reload cmd. (reload cmd now also apply update/compatibility fix)
This commit is contained in:
commit
dd831425bd
16 changed files with 307 additions and 52 deletions
|
|
@ -1,12 +1,11 @@
|
||||||
import cn.lalaki.pub.BaseCentralPortalPlusExtension
|
import cn.lalaki.pub.BaseCentralPortalPlusExtension
|
||||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "2.0.0"
|
kotlin("jvm") version "2.0.0"
|
||||||
java
|
java
|
||||||
id("org.jetbrains.dokka").version("1.9.20")
|
id("org.jetbrains.dokka").version("1.9.20")
|
||||||
id("io.github.goooler.shadow").version("8.1.8") // using fork of com.github.johnrengelman.shadow to support java 1.21
|
id("io.github.goooler.shadow").version("8.1.8") // using fork of com.github.johnrengelman.shadow to support java 1.21. edit I do not need java 1.21 now so should be replaced ?
|
||||||
// Maven publish
|
// Maven publish
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
signing
|
signing
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.group.EnchantConflictGroup;
|
import xyz.alexcrea.cuanvil.group.EnchantConflictGroup;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.global.EnchantConflictGui;
|
import xyz.alexcrea.cuanvil.gui.config.global.EnchantConflictGui;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Custom Anvil api for conflict registry.
|
* Custom Anvil api for conflict registry.
|
||||||
|
|
@ -30,18 +32,34 @@ public class ConflictAPI {
|
||||||
* @return True if successful.
|
* @return True if successful.
|
||||||
*/
|
*/
|
||||||
public static boolean addConflict(@NotNull ConflictBuilder builder){
|
public static boolean addConflict(@NotNull ConflictBuilder builder){
|
||||||
|
return addConflict(builder, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write and add a conflict.
|
||||||
|
* Will not write the conflict if it already exists.
|
||||||
|
*
|
||||||
|
* @param builder The conflict builder to be based on
|
||||||
|
* @param overrideDeleted If we should write even if the conflict was previously deleted.
|
||||||
|
* @return True if successful.
|
||||||
|
*/
|
||||||
|
public static boolean addConflict(@NotNull ConflictBuilder builder, boolean overrideDeleted){
|
||||||
FileConfiguration config = ConfigHolder.CONFLICT_HOLDER.getConfig();
|
FileConfiguration config = ConfigHolder.CONFLICT_HOLDER.getConfig();
|
||||||
|
|
||||||
|
// Test if conflict can be added
|
||||||
|
if(!overrideDeleted && ConfigHolder.CONFLICT_HOLDER.isDeleted(builder.getName())) return false;
|
||||||
if(config.contains(builder.getName())) return false;
|
if(config.contains(builder.getName())) return false;
|
||||||
|
|
||||||
if(!writeConflict(builder, false)) return false;
|
if(!writeConflict(builder, false)) return false;
|
||||||
|
|
||||||
EnchantConflictGroup conflict = builder.build();
|
|
||||||
|
|
||||||
|
EnchantConflictGroup conflict = builder.build();
|
||||||
// Register conflict
|
// Register conflict
|
||||||
ConfigHolder.CONFLICT_HOLDER.getConflictManager().addConflict(conflict);
|
ConfigHolder.CONFLICT_HOLDER.getConflictManager().addConflict(conflict);
|
||||||
|
|
||||||
// Add conflict to gui
|
// Add conflict to gui
|
||||||
EnchantConflictGui.INSTANCE.updateValueForGeneric(conflict, true);
|
EnchantConflictGui conflictGui = EnchantConflictGui.getCurrentInstance();
|
||||||
|
if(conflictGui != null) conflictGui.updateValueForGeneric(conflict, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -118,11 +136,13 @@ public class ConflictAPI {
|
||||||
ConfigHolder.CONFLICT_HOLDER.getConflictManager().removeConflict(conflict);
|
ConfigHolder.CONFLICT_HOLDER.getConflictManager().removeConflict(conflict);
|
||||||
|
|
||||||
// Write as null and save to file
|
// Write as null and save to file
|
||||||
ConfigHolder.CONFLICT_HOLDER.getConfig().set(conflict.getName(), null);
|
ConfigHolder.CONFLICT_HOLDER.delete(conflict.getName());
|
||||||
prepareSaveTask();
|
prepareSaveTask();
|
||||||
|
|
||||||
// Remove from gui
|
// Remove from gui
|
||||||
EnchantConflictGui.INSTANCE.removeGeneric(conflict);
|
EnchantConflictGui conflictGui = EnchantConflictGui.getCurrentInstance();
|
||||||
|
if(conflictGui != null) conflictGui.removeGeneric(conflict);
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +167,9 @@ public class ConflictAPI {
|
||||||
|
|
||||||
reloadChangeTask = Bukkit.getScheduler().scheduleSyncDelayedTask(CustomAnvil.instance, ()->{
|
reloadChangeTask = Bukkit.getScheduler().scheduleSyncDelayedTask(CustomAnvil.instance, ()->{
|
||||||
ConfigHolder.CONFLICT_HOLDER.reload();
|
ConfigHolder.CONFLICT_HOLDER.reload();
|
||||||
EnchantConflictGui.INSTANCE.reloadValues();
|
EnchantConflictGui conflictGui = EnchantConflictGui.getCurrentInstance();
|
||||||
|
if(conflictGui != null) conflictGui.reloadValues();
|
||||||
|
|
||||||
reloadChangeTask = -1;
|
reloadChangeTask = -1;
|
||||||
}, 0L);
|
}, 0L);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,24 @@ public class CustomAnvilRecipeApi {
|
||||||
* @return True if successful.
|
* @return True if successful.
|
||||||
*/
|
*/
|
||||||
public static boolean addRecipe(@NotNull AnvilRecipeBuilder builder){
|
public static boolean addRecipe(@NotNull AnvilRecipeBuilder builder){
|
||||||
|
return addRecipe(builder, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write and add a custom anvil recipe.
|
||||||
|
* Will not write the recipe if it already exists.
|
||||||
|
*
|
||||||
|
* @param builder The recipe builder to be based on
|
||||||
|
* @param overrideDeleted If we should write even if the recipe was previously deleted.
|
||||||
|
* @return True if successful.
|
||||||
|
*/
|
||||||
|
public static boolean addRecipe(@NotNull AnvilRecipeBuilder builder, boolean overrideDeleted){
|
||||||
FileConfiguration config = ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig();
|
FileConfiguration config = ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig();
|
||||||
String name = builder.getName();
|
String name = builder.getName();
|
||||||
|
|
||||||
|
if(!overrideDeleted && ConfigHolder.CUSTOM_RECIPE_HOLDER.isDeleted(builder.getName())) return false;
|
||||||
if(config.contains(builder.getName())) return false;
|
if(config.contains(builder.getName())) return false;
|
||||||
|
|
||||||
if(builder.getName().contains(".")) {
|
if(builder.getName().contains(".")) {
|
||||||
CustomAnvil.instance.getLogger().warning("Custom anvil recipe " + name + " contain \".\" in its name but should not. this recipe is ignored.");
|
CustomAnvil.instance.getLogger().warning("Custom anvil recipe " + name + " contain \".\" in its name but should not. this recipe is ignored.");
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -58,7 +72,8 @@ public class CustomAnvilRecipeApi {
|
||||||
prepareSaveTask();
|
prepareSaveTask();
|
||||||
|
|
||||||
// Add from gui
|
// Add from gui
|
||||||
CustomRecipeConfigGui.INSTANCE.updateValueForGeneric(recipe, true);
|
CustomRecipeConfigGui recipeConfigGui = CustomRecipeConfigGui.getCurrentInstance();
|
||||||
|
if(recipeConfigGui != null) recipeConfigGui.updateValueForGeneric(recipe, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -74,11 +89,12 @@ public class CustomAnvilRecipeApi {
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.getRecipeManager().cleanRemove(recipe);
|
ConfigHolder.CUSTOM_RECIPE_HOLDER.getRecipeManager().cleanRemove(recipe);
|
||||||
|
|
||||||
// Write as null and save to file
|
// Write as null and save to file
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig().set(recipe.getName(), null);
|
ConfigHolder.CUSTOM_RECIPE_HOLDER.delete(recipe.getName());
|
||||||
prepareSaveTask();
|
prepareSaveTask();
|
||||||
|
|
||||||
// Remove from gui
|
// Remove from gui
|
||||||
CustomRecipeConfigGui.INSTANCE.removeGeneric(recipe);
|
CustomRecipeConfigGui recipeConfigGui = CustomRecipeConfigGui.getCurrentInstance();
|
||||||
|
if(recipeConfigGui != null) recipeConfigGui.removeGeneric(recipe);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,22 +27,41 @@ public class MaterialGroupApi {
|
||||||
private static int saveChangeTask = -1;
|
private static int saveChangeTask = -1;
|
||||||
private static int reloadChangeTask = -1;
|
private static int reloadChangeTask = -1;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write and add a group.
|
* Write and add a group.
|
||||||
* Will not write the group if it already exists.
|
* Will not write the group if it already exists.
|
||||||
*
|
*
|
||||||
* @param group the group to add
|
* @param group The group to add
|
||||||
* @return true if successful.
|
* @return true if successful.
|
||||||
*/
|
*/
|
||||||
public static boolean addMaterialGroup(@NotNull AbstractMaterialGroup group){
|
public static boolean addMaterialGroup(@NotNull AbstractMaterialGroup group){
|
||||||
|
return addMaterialGroup(group, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write and add a group.
|
||||||
|
* Will not write the group if it already exists.
|
||||||
|
*
|
||||||
|
* @param group The group to add
|
||||||
|
* @param overrideDeleted If we should write even if the group was previously deleted.
|
||||||
|
* @return true if successful.
|
||||||
|
*/
|
||||||
|
public static boolean addMaterialGroup(@NotNull AbstractMaterialGroup group, boolean overrideDeleted){
|
||||||
ItemGroupManager itemGroupManager = ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager();
|
ItemGroupManager itemGroupManager = ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager();
|
||||||
|
|
||||||
|
// Test if it exists/existed
|
||||||
|
if(!overrideDeleted && ConfigHolder.ITEM_GROUP_HOLDER.isDeleted(group.getName())) return false;
|
||||||
if(itemGroupManager.get(group.getName()) != null) return false;
|
if(itemGroupManager.get(group.getName()) != null) return false;
|
||||||
|
|
||||||
|
// Add group
|
||||||
itemGroupManager.getGroupMap().put(group.getName(), group);
|
itemGroupManager.getGroupMap().put(group.getName(), group);
|
||||||
|
|
||||||
if(!writeMaterialGroup(group, false)) return false;
|
if(!writeMaterialGroup(group, false)) return false;
|
||||||
|
|
||||||
if(group instanceof IncludeGroup includeGroup){
|
if(group instanceof IncludeGroup includeGroup){
|
||||||
GroupConfigGui.INSTANCE.updateValueForGeneric(includeGroup, true);
|
GroupConfigGui configGui = GroupConfigGui.getCurrentInstance();
|
||||||
|
if(configGui != null) configGui.updateValueForGeneric(includeGroup, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ConfigOptions.INSTANCE.getVerboseDebugLog()){
|
if(ConfigOptions.INSTANCE.getVerboseDebugLog()){
|
||||||
|
|
@ -145,12 +164,13 @@ public class MaterialGroupApi {
|
||||||
ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager().groupMap.remove(group.getName());
|
ConfigHolder.ITEM_GROUP_HOLDER.getItemGroupsManager().groupMap.remove(group.getName());
|
||||||
|
|
||||||
// Write as null and save to file
|
// Write as null and save to file
|
||||||
ConfigHolder.ITEM_GROUP_HOLDER.getConfig().set(group.getName(), null);
|
ConfigHolder.ITEM_GROUP_HOLDER.delete(group.getName());
|
||||||
prepareSaveTask();
|
prepareSaveTask();
|
||||||
|
|
||||||
// Remove from gui
|
// Remove from gui
|
||||||
if(group instanceof IncludeGroup includeGroup){
|
if(group instanceof IncludeGroup includeGroup){
|
||||||
GroupConfigGui.INSTANCE.removeGeneric(includeGroup);
|
GroupConfigGui configGui = GroupConfigGui.getCurrentInstance();
|
||||||
|
if(configGui != null) configGui.removeGeneric(includeGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -176,7 +196,10 @@ public class MaterialGroupApi {
|
||||||
|
|
||||||
reloadChangeTask = Bukkit.getScheduler().scheduleSyncDelayedTask(CustomAnvil.instance, ()->{
|
reloadChangeTask = Bukkit.getScheduler().scheduleSyncDelayedTask(CustomAnvil.instance, ()->{
|
||||||
ConfigHolder.ITEM_GROUP_HOLDER.reload();
|
ConfigHolder.ITEM_GROUP_HOLDER.reload();
|
||||||
GroupConfigGui.INSTANCE.reloadValues();
|
|
||||||
|
GroupConfigGui configGui = GroupConfigGui.getCurrentInstance();
|
||||||
|
if(configGui != null) configGui.reloadValues();
|
||||||
|
|
||||||
reloadChangeTask = -1;
|
reloadChangeTask = -1;
|
||||||
}, 0L);
|
}, 0L);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,17 @@ import com.google.common.io.Files;
|
||||||
import io.delilaheve.CustomAnvil;
|
import io.delilaheve.CustomAnvil;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import xyz.alexcrea.cuanvil.group.EnchantConflictManager;
|
import xyz.alexcrea.cuanvil.group.EnchantConflictManager;
|
||||||
import xyz.alexcrea.cuanvil.group.ItemGroupManager;
|
import xyz.alexcrea.cuanvil.group.ItemGroupManager;
|
||||||
import xyz.alexcrea.cuanvil.recipe.CustomAnvilRecipeManager;
|
import xyz.alexcrea.cuanvil.recipe.CustomAnvilRecipeManager;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public abstract class ConfigHolder {
|
public abstract class ConfigHolder {
|
||||||
|
|
||||||
// Available configuration:
|
// Available configuration:
|
||||||
|
|
@ -140,7 +144,7 @@ public abstract class ConfigHolder {
|
||||||
Files.copy(base, firstBackup);
|
Files.copy(base, firstBackup);
|
||||||
sufficientSuccess = true;
|
sufficientSuccess = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "Could not copy backup saving config " + base.getName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// save last backup
|
// save last backup
|
||||||
|
|
@ -200,15 +204,126 @@ public abstract class ConfigHolder {
|
||||||
YamlConfiguration configuration = CustomAnvil.instance.reloadResource(
|
YamlConfiguration configuration = CustomAnvil.instance.reloadResource(
|
||||||
getConfigFileName() + getConfigFileExtension(), hardFail);
|
getConfigFileName() + getConfigFileExtension(), hardFail);
|
||||||
if (configuration == null) return false;
|
if (configuration == null) return false;
|
||||||
|
|
||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract static class DeletableResource extends ResourceConfigHolder{
|
||||||
|
|
||||||
|
private static final String DELETED_FOLDER_PATH = "deleted";
|
||||||
|
|
||||||
|
private final @NotNull File parent;
|
||||||
|
private final @NotNull File deletedConfigFile;
|
||||||
|
|
||||||
|
private @Nullable YamlConfiguration deletedListConfig;
|
||||||
|
private DeletableResource(String resourceName) {
|
||||||
|
super(resourceName);
|
||||||
|
this.parent = new File(CustomAnvil.instance.getDataFolder(), DELETED_FOLDER_PATH);
|
||||||
|
this.deletedConfigFile = new File(this.parent, "deleted_" + resourceName + getConfigFileExtension());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean reloadFromDisk(boolean hardFail) {
|
||||||
|
if(!super.reloadFromDisk(hardFail)) return false;
|
||||||
|
loadDeletedListFile(hardFail);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadDeletedListFile(boolean hardFail){
|
||||||
|
this.deletedListConfig = CustomAnvil.instance.reloadResource(this.deletedConfigFile, hardFail);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test if the provided element was deleted.
|
||||||
|
* @param objectPath The object path to delete.
|
||||||
|
* @return True if successful.
|
||||||
|
*/
|
||||||
|
public boolean isDeleted(String objectPath){
|
||||||
|
if(this.deletedListConfig == null) return false;
|
||||||
|
|
||||||
|
return this.deletedListConfig.getBoolean(objectPath, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a certain object by its path. do not save the config.
|
||||||
|
* @param objectPath The object path to delete.
|
||||||
|
* @return True if successful.
|
||||||
|
*/
|
||||||
|
public boolean delete(String objectPath){
|
||||||
|
return delete(objectPath, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a certain object by its path.
|
||||||
|
* @param objectPath The object path to delete.
|
||||||
|
* @param doSave If we should save the config after deleting.
|
||||||
|
* @param doBackup If we should create a backup.
|
||||||
|
* @return True if successful.
|
||||||
|
*/
|
||||||
|
public boolean delete(String objectPath, boolean doSave, boolean doBackup){
|
||||||
|
// Create deleted list if it does not yet exist
|
||||||
|
if(this.deletedListConfig == null){
|
||||||
|
this.parent.mkdirs();
|
||||||
|
try {
|
||||||
|
this.deletedConfigFile.createNewFile();
|
||||||
|
} catch (IOException e) {
|
||||||
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "Could not create " + this.deletedConfigFile.getPath(), e);
|
||||||
|
}
|
||||||
|
loadDeletedListFile(false);
|
||||||
|
|
||||||
|
// Something was wrong somehow
|
||||||
|
if(this.deletedListConfig == null) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add to the deleted config
|
||||||
|
this.deletedListConfig.set(objectPath, true);
|
||||||
|
this.getConfig().set(objectPath, null);
|
||||||
|
|
||||||
|
// Save the deleted config (may not be the most efficient, but I will handle it later)
|
||||||
|
if(doSave){
|
||||||
|
return saveToDisk(doBackup);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveToDisk(boolean doBackup) {
|
||||||
|
boolean deletedSaveSuccess = saveDeletedList();
|
||||||
|
|
||||||
|
return super.saveToDisk(doBackup) && deletedSaveSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save list of deleted elements.
|
||||||
|
* @return true if successful.
|
||||||
|
*/
|
||||||
|
public boolean saveDeletedList() {
|
||||||
|
if(this.deletedListConfig == null) return true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
this.deletedListConfig.save(this.deletedConfigFile);
|
||||||
|
} catch (IOException e) {
|
||||||
|
CustomAnvil.instance.getLogger().log(Level.WARNING, "Could not save " + this.deletedConfigFile.getPath(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Class for itemGroupsManager config
|
// Class for itemGroupsManager config
|
||||||
public static class ItemGroupConfigHolder extends ResourceConfigHolder {
|
public static class ItemGroupConfigHolder extends DeletableResource {
|
||||||
private static final String FILE_NAME = "item_groups";
|
private static final String FILE_NAME = "item_groups";
|
||||||
|
|
||||||
ItemGroupManager itemGroupsManager;
|
ItemGroupManager itemGroupsManager;
|
||||||
|
|
@ -235,7 +350,7 @@ public abstract class ConfigHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class for enchant conflict config
|
// Class for enchant conflict config
|
||||||
public static class ConflictConfigHolder extends ResourceConfigHolder {
|
public static class ConflictConfigHolder extends DeletableResource {
|
||||||
private static final String FILE_NAME = "enchant_conflict";
|
private static final String FILE_NAME = "enchant_conflict";
|
||||||
|
|
||||||
EnchantConflictManager conflictManager;
|
EnchantConflictManager conflictManager;
|
||||||
|
|
@ -259,10 +374,9 @@ public abstract class ConfigHolder {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Class for unit repair config
|
// Class for unit repair config
|
||||||
public static class UnitRepairHolder extends ResourceConfigHolder {
|
public static class UnitRepairHolder extends DeletableResource {
|
||||||
private static final String ITEM_GROUP_FILE_NAME = "unit_repair_item";
|
private static final String ITEM_GROUP_FILE_NAME = "unit_repair_item";
|
||||||
|
|
||||||
|
|
||||||
private UnitRepairHolder() {
|
private UnitRepairHolder() {
|
||||||
super(ITEM_GROUP_FILE_NAME);
|
super(ITEM_GROUP_FILE_NAME);
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +389,7 @@ public abstract class ConfigHolder {
|
||||||
|
|
||||||
|
|
||||||
// Class for custom anvil craft
|
// Class for custom anvil craft
|
||||||
public static class CustomAnvilCraftHolder extends ResourceConfigHolder {
|
public static class CustomAnvilCraftHolder extends DeletableResource {
|
||||||
private static final String CUSTOM_RECIPE_FILE_NAME = "custom_recipes";
|
private static final String CUSTOM_RECIPE_FILE_NAME = "custom_recipes";
|
||||||
CustomAnvilRecipeManager recipeManager;
|
CustomAnvilRecipeManager recipeManager;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class MainConfigGui extends ChestGui {
|
||||||
enchantConflictMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment conflict menu"));
|
enchantConflictMeta.setLore(Collections.singletonList("\u00A77Click here to open enchantment conflict menu"));
|
||||||
enchantConflictItemstack.setItemMeta(enchantConflictMeta);
|
enchantConflictItemstack.setItemMeta(enchantConflictMeta);
|
||||||
|
|
||||||
GuiItem enchantConflictItem = GuiGlobalItems.goToGuiItem(enchantConflictItemstack, EnchantConflictGui.INSTANCE);
|
GuiItem enchantConflictItem = GuiGlobalItems.goToGuiItem(enchantConflictItemstack, EnchantConflictGui.getInstance());
|
||||||
pane.bindItem('4', enchantConflictItem);
|
pane.bindItem('4', enchantConflictItem);
|
||||||
|
|
||||||
// Group config items
|
// Group config items
|
||||||
|
|
@ -94,7 +94,7 @@ public class MainConfigGui extends ChestGui {
|
||||||
groupMeta.setLore(Collections.singletonList("\u00A77Click here to open material group menu"));
|
groupMeta.setLore(Collections.singletonList("\u00A77Click here to open material group menu"));
|
||||||
groupItemstack.setItemMeta(groupMeta);
|
groupItemstack.setItemMeta(groupMeta);
|
||||||
|
|
||||||
GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.INSTANCE);
|
GuiItem groupConfigItem = GuiGlobalItems.goToGuiItem(groupItemstack, GroupConfigGui.getInstance());
|
||||||
|
|
||||||
pane.bindItem('5', groupConfigItem);
|
pane.bindItem('5', groupConfigItem);
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ public class MainConfigGui extends ChestGui {
|
||||||
unitRepairMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil unit repair menu"));
|
unitRepairMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil unit repair menu"));
|
||||||
unirRepairItemstack.setItemMeta(unitRepairMeta);
|
unirRepairItemstack.setItemMeta(unitRepairMeta);
|
||||||
|
|
||||||
GuiItem unitRepairItem = GuiGlobalItems.goToGuiItem(unirRepairItemstack, UnitRepairConfigGui.INSTANCE);
|
GuiItem unitRepairItem = GuiGlobalItems.goToGuiItem(unirRepairItemstack, UnitRepairConfigGui.getInstance());
|
||||||
pane.bindItem('6', unitRepairItem);
|
pane.bindItem('6', unitRepairItem);
|
||||||
|
|
||||||
// Custom recipe item
|
// Custom recipe item
|
||||||
|
|
@ -119,7 +119,7 @@ public class MainConfigGui extends ChestGui {
|
||||||
customRecipeMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil custom recipe menu"));
|
customRecipeMeta.setLore(Collections.singletonList("\u00A77Click here to open anvil custom recipe menu"));
|
||||||
customRecipeItemstack.setItemMeta(customRecipeMeta);
|
customRecipeItemstack.setItemMeta(customRecipeMeta);
|
||||||
|
|
||||||
GuiItem customRecipeItem = GuiGlobalItems.goToGuiItem(customRecipeItemstack, CustomRecipeConfigGui.INSTANCE);
|
GuiItem customRecipeItem = GuiGlobalItems.goToGuiItem(customRecipeItemstack, CustomRecipeConfigGui.getInstance());
|
||||||
pane.bindItem('7', customRecipeItem);
|
pane.bindItem('7', customRecipeItem);
|
||||||
|
|
||||||
// quit item
|
// quit item
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.elements.CustomRecipeSubSettingGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.elements.CustomRecipeSubSettingGui;
|
||||||
|
|
@ -17,10 +19,18 @@ import java.util.Collection;
|
||||||
public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRecipe, CustomRecipeSubSettingGui> {
|
public class CustomRecipeConfigGui extends MappedGuiListConfigGui<AnvilCustomRecipe, CustomRecipeSubSettingGui> {
|
||||||
|
|
||||||
|
|
||||||
public final static CustomRecipeConfigGui INSTANCE = new CustomRecipeConfigGui();
|
private static CustomRecipeConfigGui INSTANCE = new CustomRecipeConfigGui();
|
||||||
|
|
||||||
static {
|
@Nullable
|
||||||
INSTANCE.init();
|
public static CustomRecipeConfigGui getCurrentInstance(){
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static CustomRecipeConfigGui getInstance(){
|
||||||
|
if(INSTANCE == null) INSTANCE = new CustomRecipeConfigGui();
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CustomRecipeConfigGui() {
|
private CustomRecipeConfigGui() {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.group.EnchantConflictGroup;
|
import xyz.alexcrea.cuanvil.group.EnchantConflictGroup;
|
||||||
import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
import xyz.alexcrea.cuanvil.group.IncludeGroup;
|
||||||
|
|
@ -18,14 +20,25 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGroup, EnchantConflictSubSettingGui> {
|
public class EnchantConflictGui extends MappedGuiListConfigGui<EnchantConflictGroup, EnchantConflictSubSettingGui> {
|
||||||
|
|
||||||
public static final EnchantConflictGui INSTANCE = new EnchantConflictGui();
|
private static EnchantConflictGui INSTANCE;
|
||||||
|
|
||||||
static {
|
@Nullable
|
||||||
INSTANCE.init();
|
public static EnchantConflictGui getCurrentInstance(){
|
||||||
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static EnchantConflictGui getInstance(){
|
||||||
|
if(INSTANCE == null) INSTANCE = new EnchantConflictGui();
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private EnchantConflictGui() {
|
private EnchantConflictGui() {
|
||||||
super( "Conflict Config");
|
super( "Conflict Config");
|
||||||
|
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.group.AbstractMaterialGroup;
|
import xyz.alexcrea.cuanvil.group.AbstractMaterialGroup;
|
||||||
import xyz.alexcrea.cuanvil.group.GroupType;
|
import xyz.alexcrea.cuanvil.group.GroupType;
|
||||||
|
|
@ -20,14 +22,24 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, GroupConfigSubSettingGui> {
|
public class GroupConfigGui extends MappedGuiListConfigGui<IncludeGroup, GroupConfigSubSettingGui> {
|
||||||
|
|
||||||
public final static GroupConfigGui INSTANCE = new GroupConfigGui();
|
private static GroupConfigGui INSTANCE;
|
||||||
|
|
||||||
static {
|
@Nullable
|
||||||
INSTANCE.init();
|
public static GroupConfigGui getCurrentInstance(){
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static GroupConfigGui getInstance(){
|
||||||
|
if(INSTANCE == null) INSTANCE = new GroupConfigGui();
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GroupConfigGui() {
|
public GroupConfigGui() {
|
||||||
super("Group Config");
|
super("Group Config");
|
||||||
|
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
import xyz.alexcrea.cuanvil.config.ConfigHolder;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.ask.SelectItemTypeGui;
|
import xyz.alexcrea.cuanvil.gui.config.ask.SelectItemTypeGui;
|
||||||
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
import xyz.alexcrea.cuanvil.gui.config.list.MappedGuiListConfigGui;
|
||||||
|
|
@ -18,14 +20,24 @@ import java.util.Collection;
|
||||||
|
|
||||||
public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRepairElementListGui> {
|
public class UnitRepairConfigGui extends MappedGuiListConfigGui<Material, UnitRepairElementListGui> {
|
||||||
|
|
||||||
public static final UnitRepairConfigGui INSTANCE = new UnitRepairConfigGui();
|
private static UnitRepairConfigGui INSTANCE;
|
||||||
|
|
||||||
static {
|
@Nullable
|
||||||
INSTANCE.init();
|
public static UnitRepairConfigGui getCurrentInstance(){
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static UnitRepairConfigGui getInstance(){
|
||||||
|
if(INSTANCE == null) INSTANCE = new UnitRepairConfigGui();
|
||||||
|
|
||||||
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private UnitRepairConfigGui() {
|
private UnitRepairConfigGui() {
|
||||||
super("Unit Repair Config");
|
super("Unit Repair Config");
|
||||||
|
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ public class CustomRecipeSubSettingGui extends MappedToListSubSettingGui {
|
||||||
cleanAndBeUnusable();
|
cleanAndBeUnusable();
|
||||||
|
|
||||||
// Update config file storage
|
// Update config file storage
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig().set(this.anvilRecipe.toString(), null);
|
ConfigHolder.CUSTOM_RECIPE_HOLDER.delete(this.anvilRecipe.toString());
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ public class EnchantConflictSubSettingGui extends MappedToListSubSettingGui impl
|
||||||
cleanAndBeUnusable();
|
cleanAndBeUnusable();
|
||||||
|
|
||||||
// Update config file storage
|
// Update config file storage
|
||||||
ConfigHolder.CONFLICT_HOLDER.getConfig().set(this.enchantConflict.toString(), null);
|
ConfigHolder.CONFLICT_HOLDER.delete(this.enchantConflict.toString());
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ public class GroupConfigSubSettingGui extends MappedToListSubSettingGui implemen
|
||||||
cleanAndBeUnusable();
|
cleanAndBeUnusable();
|
||||||
|
|
||||||
// Update config file storage
|
// Update config file storage
|
||||||
ConfigHolder.CUSTOM_RECIPE_HOLDER.getConfig().set(this.group.getName(), null);
|
ConfigHolder.CUSTOM_RECIPE_HOLDER.delete(this.group.getName());
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
|
|
|
||||||
|
|
@ -316,7 +316,11 @@ public class DoubleSettingGui extends AbstractSettingGui {
|
||||||
@Override
|
@Override
|
||||||
public boolean onSave() {
|
public boolean onSave() {
|
||||||
if(isNull()){
|
if(isNull()){
|
||||||
|
if(this.holder.config instanceof ConfigHolder.DeletableResource deletableResource){
|
||||||
|
deletableResource.delete(this.holder.configPath);
|
||||||
|
}else{
|
||||||
this.holder.config.getConfig().set(this.holder.configPath, null);
|
this.holder.config.getConfig().set(this.holder.configPath, null);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
this.holder.config.getConfig().set(this.holder.configPath, now.doubleValue());
|
this.holder.config.getConfig().set(this.holder.configPath, now.doubleValue());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,10 @@ class CustomAnvil : JavaPlugin() {
|
||||||
// temporary: handle 1.21 update
|
// temporary: handle 1.21 update
|
||||||
Update_1_21.handleUpdate()
|
Update_1_21.handleUpdate()
|
||||||
|
|
||||||
|
// Register enchantment of compatible plugin and load configuration change.
|
||||||
|
DependencyManager.handleCompatibilityConfig()
|
||||||
|
|
||||||
|
// Call config event
|
||||||
val configReadyEvent = CAConfigReadyEvent()
|
val configReadyEvent = CAConfigReadyEvent()
|
||||||
server.pluginManager.callEvent(configReadyEvent)
|
server.pluginManager.callEvent(configReadyEvent)
|
||||||
|
|
||||||
|
|
@ -135,8 +139,6 @@ class CustomAnvil : JavaPlugin() {
|
||||||
MainConfigGui.getInstance().init(DependencyManager.packetManager)
|
MainConfigGui.getInstance().init(DependencyManager.packetManager)
|
||||||
GuiSharedConstant.loadConstants()
|
GuiSharedConstant.loadConstants()
|
||||||
|
|
||||||
// Register enchantment of compatible plugin and load configuration change.
|
|
||||||
DependencyManager.handleCompatibilityConfig()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun reloadResource(
|
fun reloadResource(
|
||||||
|
|
@ -148,20 +150,34 @@ class CustomAnvil : JavaPlugin() {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
saveResource(resourceName, false)
|
saveResource(resourceName, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return reloadResource(file, hardFailSafe)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Unlike above function. this function will not clone default from jar.
|
||||||
|
fun reloadResource(
|
||||||
|
resourceFile: File,
|
||||||
|
hardFailSafe: Boolean = true
|
||||||
|
): YamlConfiguration? {
|
||||||
|
// Test if file exist
|
||||||
|
if (!resourceFile.exists()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
// Load resource
|
// Load resource
|
||||||
val yamlConfig = YamlConfiguration()
|
val yamlConfig = YamlConfiguration()
|
||||||
try {
|
try {
|
||||||
val configReader = FileReader(file)
|
val configReader = FileReader(resourceFile)
|
||||||
yamlConfig.load(configReader)
|
yamlConfig.load(configReader)
|
||||||
} catch (test: Exception) {
|
} catch (test: Exception) {
|
||||||
if (hardFailSafe) {
|
if (hardFailSafe) {
|
||||||
// This is important and may impact gameplay if it does not load.
|
// This is important and may impact gameplay if it does not load.
|
||||||
// Failsafe is to stop the plugin
|
// Failsafe is to stop the plugin
|
||||||
logger.severe("Resource $resourceName Could not be load or reload.")
|
logger.severe("Resource ${resourceFile.path} Could not be load or reload.")
|
||||||
logger.severe("Disabling plugin.")
|
logger.severe("Disabling plugin.")
|
||||||
Bukkit.getPluginManager().disablePlugin(this)
|
Bukkit.getPluginManager().disablePlugin(this)
|
||||||
} else {
|
} else {
|
||||||
logger.warning("Resource $resourceName Could not be load or reload.")
|
logger.warning("Resource ${resourceFile.path} Could not be load or reload.")
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
package xyz.alexcrea.cuanvil.command
|
package xyz.alexcrea.cuanvil.command
|
||||||
|
|
||||||
import io.delilaheve.CustomAnvil
|
import io.delilaheve.CustomAnvil
|
||||||
|
import org.bukkit.Bukkit
|
||||||
import org.bukkit.command.Command
|
import org.bukkit.command.Command
|
||||||
import org.bukkit.command.CommandExecutor
|
import org.bukkit.command.CommandExecutor
|
||||||
import org.bukkit.command.CommandSender
|
import org.bukkit.command.CommandSender
|
||||||
|
import xyz.alexcrea.cuanvil.api.event.CAConfigReadyEvent
|
||||||
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
import xyz.alexcrea.cuanvil.config.ConfigHolder
|
||||||
|
import xyz.alexcrea.cuanvil.dependency.DependencyManager
|
||||||
import xyz.alexcrea.cuanvil.gui.config.global.*
|
import xyz.alexcrea.cuanvil.gui.config.global.*
|
||||||
|
import xyz.alexcrea.cuanvil.update.Update_1_21
|
||||||
|
|
||||||
class ReloadExecutor : CommandExecutor {
|
class ReloadExecutor : CommandExecutor {
|
||||||
override fun onCommand(sender: CommandSender, cmd: Command, cmdstr: String, args: Array<out String>): Boolean {
|
override fun onCommand(sender: CommandSender, cmd: Command, cmdstr: String, args: Array<out String>): Boolean {
|
||||||
|
|
@ -39,10 +43,20 @@ class ReloadExecutor : CommandExecutor {
|
||||||
EnchantCostConfigGui.getInstance()?.updateGuiValues()
|
EnchantCostConfigGui.getInstance()?.updateGuiValues()
|
||||||
EnchantLimitConfigGui.getInstance()?.updateGuiValues()
|
EnchantLimitConfigGui.getInstance()?.updateGuiValues()
|
||||||
|
|
||||||
EnchantConflictGui.INSTANCE.reloadValues()
|
EnchantConflictGui.getCurrentInstance()?.reloadValues()
|
||||||
GroupConfigGui.INSTANCE.reloadValues()
|
GroupConfigGui.getCurrentInstance()?.reloadValues()
|
||||||
UnitRepairConfigGui.INSTANCE.reloadValues()
|
UnitRepairConfigGui.getCurrentInstance()?.reloadValues()
|
||||||
CustomRecipeConfigGui.INSTANCE.reloadValues()
|
CustomRecipeConfigGui.getCurrentInstance()?.reloadValues()
|
||||||
|
|
||||||
|
// temporary: handle 1.21 update
|
||||||
|
Update_1_21.handleUpdate()
|
||||||
|
|
||||||
|
// Register enchantment of compatible plugin and load configuration change.
|
||||||
|
DependencyManager.handleCompatibilityConfig()
|
||||||
|
|
||||||
|
// Call event
|
||||||
|
val configReadyEvent = CAConfigReadyEvent()
|
||||||
|
Bukkit.getServer().pluginManager.callEvent(configReadyEvent)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue