(gradle) Rename core -> api

This commit is contained in:
Ryder Belserion 2023-03-04 22:34:21 -05:00
parent 8187592b3c
commit c917f5cbfd
No known key found for this signature in database
GPG Key ID: 8FC2E6C54BBF05FE
7 changed files with 90 additions and 18 deletions

View File

@ -15,12 +15,13 @@ dependencies {
//compileOnly(libs.adventure.text)
compileOnly(libs.config.me)
compileOnly(libs.yaml)
compileOnly(libs.crazycore)
compileOnly(libs.crazycore.api)
}
tasks {
shadowJar {
archiveFileName.set("$projectName+core+$finalVersion.jar")
archiveFileName.set("$projectName+api+$finalVersion.jar")
}
}

View File

@ -0,0 +1,43 @@
package us.crazycrew.crazyauctions.configurations;
import ch.jalu.configme.SettingsHolder;
import ch.jalu.configme.configurationdata.CommentsConfiguration;
/**
* @author RyderBelserion
* @author BadBones69
*
* Date: 3/4/2023
* Time: 10:22 PM
* Last Edited: 3/4/2023 @ 10:22 PM
*
* Description: The config.yml options.
*/
public class ConfigSettings implements SettingsHolder {
// Empty constructor required by SettingsHolder
public ConfigSettings() {}
@Override
public void registerComments(CommentsConfiguration conf) {
String[] header = {
"Support: https://discord.gg/crazycrew",
"Github: https://github.com/Crazy-Crew",
"",
"Issues: https://github.com/Crazy-Crew/CrazyCrates/issues",
"Features: https://github.com/Crazy-Crew/CrazyCrates/discussions",
"",
"Legacy color codes such as &7,&c no longer work. You must use MiniMessage",
"https://docs.advntr.dev/minimessage/format.html#color"
};
String[] deprecation = {
"",
"Warning: This section is subject to change so it is considered deprecated.",
"This is your warning before the change happens.",
""
};
conf.setComment("settings", header);
}
}

View File

@ -1,4 +1,4 @@
package us.crazycrew.crazyauctions.configs;
package us.crazycrew.crazyauctions.configurations;
import ch.jalu.configme.Comment;
import ch.jalu.configme.SettingsHolder;
@ -6,6 +6,16 @@ import ch.jalu.configme.configurationdata.CommentsConfiguration;
import ch.jalu.configme.properties.Property;
import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
/**
* @author RyderBelserion
* @author BadBones69
*
* Date: 2/28/2023
* Time: Unknown
* Last Edited: 3/4/2023 @ 10:23 PM
*
* Description: The plugin-settings.yml options.
*/
public class PluginSettings implements SettingsHolder {
// Empty constructor required by SettingsHolder
@ -17,13 +27,20 @@ public class PluginSettings implements SettingsHolder {
"Support: https://discord.gg/crazycrew",
"Github: https://github.com/Crazy-Crew",
"",
"Issues: https://github.com/Crazy-Crew/CrazyCrates/issues",
"Features: https://github.com/Crazy-Crew/CrazyCrates/discussions"
"Issues: https://github.com/Crazy-Crew/CrazyAuctions/issues",
"Features: https://github.com/Crazy-Crew/CrazyAuctions/discussions"
};
conf.setComment("settings", header);
}
@Comment({
"Choose what prefix you want to use for the permission i.e crazyauctions.command.player.help",
"",
"Warning: any changes requires a restart!"
})
public static final Property<String> COMMAND_PERMISSION = newProperty("settings.permission", "crazyauctions");
@Comment("The command prefix that is shown at the beginning of every message.")
public static final Property<String> COMMAND_PREFIX = newProperty("settings.prefix.command", "<red>[</red><green>CrazyAuctions</green><red>]</green> ");
@ -54,8 +71,9 @@ public class PluginSettings implements SettingsHolder {
@Comment({
"What command aliases do you want to use?",
"You can use as many as you would like, Separate each command using : and do not use any spaces!"
"You can use as many as you would like, Separate each command using : and do not use any spaces!",
"",
"Warning: any changes requires a restart!"
})
public static final Property<String> PLUGIN_ALIASES = newProperty("settings.plugin-aliases", "crazyauctions:ca");
public static final Property<String> PLUGIN_ALIASES = newProperty("settings.plugin-aliases", "crazyauctions:auctions");
}

View File

@ -1,19 +1,21 @@
package us.crazycrew.crazyauctions.configs.migrations;
package us.crazycrew.crazyauctions.configurations.migrations;
import ch.jalu.configme.configurationdata.ConfigurationData;
import ch.jalu.configme.migration.PlainMigrationService;
import ch.jalu.configme.resource.PropertyReader;
import org.bukkit.configuration.file.YamlConfiguration;
import org.simpleyaml.configuration.file.YamlConfiguration;
import us.crazycrew.crazycore.CrazyCore;
import us.crazycrew.crazycore.CrazyLogger;
import java.io.IOException;
import java.nio.file.Path;
/**
* @author RyderBelserion
* @author BadBones69
*
* Date: 2/28/2023
* Time: 1:26 AM
* Date: 3/1/2023
* Time: 12:41 PM
* Last Edited: 3/1/2023 @ 12:42 PM
*
* Description: Migrate old values to new values.
*/
@ -21,15 +23,21 @@ public class PluginMigrationService extends PlainMigrationService {
@Override
protected boolean performMigrations(PropertyReader reader, ConfigurationData configurationData) {
return convert(reader, "example.test", "config.yml", true)
| convert(reader, "", "", true);
//return moveProperty(oldPrefix, newPrefix, reader, configurationData);
return false;
}
private boolean convert(PropertyReader reader, String oldValue, String newFile, boolean cascade) {
if (reader.contains(oldValue)) {
Path nFile = CrazyCore.api().getDirectory().resolve(newFile);
YamlConfiguration yamlNewFile = YamlConfiguration.loadConfiguration(nFile.toFile());
YamlConfiguration yamlNewFile = null;
try {
yamlNewFile = YamlConfiguration.loadConfiguration(nFile.toFile());
} catch (IOException exception) {
exception.printStackTrace();
}
CrazyLogger.info("Starting the config migration process...");
CrazyLogger.info("Found old config value (" + oldValue + ")");
@ -43,6 +51,8 @@ public class PluginMigrationService extends PlainMigrationService {
}
}
if (yamlNewFile == null) return false;
for (String child : reader.getChildKeys(oldValue)) {
if (cascade) {
for (String doubleChild : reader.getChildKeys(child)) {

View File

@ -14,7 +14,7 @@ repositories {
}
dependencies {
api(project(":crazyauctions-core"))
api(project(":crazyauctions-api"))
compileOnly(libs.paper)

View File

@ -21,8 +21,8 @@ pluginManagement {
val lowerCase = rootProject.name.lowercase()
include("core")
project(":core").name = "$lowerCase-core"
include("api")
project(":api").name = "$lowerCase-api"
listOf("platforms").forEach(::includeProject)