diff --git a/pom.xml b/pom.xml
index 4e3a88a..6b1f3ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.github.pinont
singularitylib
- 1.3.0-SNAPSHOT
+ 1.3.2-SNAPSHOT
jar
SingularityLib
@@ -131,46 +131,37 @@
-
+
org.apache.maven.plugins
- maven-deploy-plugin
- 3.1.2
-
-
-
-
- org.codehaus.gmaven
- groovy-maven-plugin
- 2.1.1
+ maven-shade-plugin
+ 3.5.3
+
+
+
+ org.reflections:reflections
+
+ org/reflections/**
+
+
+
+
- initialize
+ package
- execute
+ shade
-
-
- // Extract Paper version from MockBukkit JAR
- def mockbukkitJar = project.artifacts.find {
- it.artifactId.startsWith('mockbukkit-')
- }?.file
-
- if (mockbukkitJar) {
- def jar = new java.util.jar.JarFile(mockbukkitJar)
- def manifest = jar.manifest
- def paperVersion = manifest.mainAttributes.getValue('Paper-Version')
- jar.close()
-
- if (paperVersion) {
- project.properties['paper.version.from.mockbukkit'] = paperVersion
- }
- }
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 3.1.2
+
diff --git a/src/main/java/com/github/pinont/singularitylib/api/Plugin.java b/src/main/java/com/github/pinont/singularitylib/api/Plugin.java
new file mode 100644
index 0000000..afe6287
--- /dev/null
+++ b/src/main/java/com/github/pinont/singularitylib/api/Plugin.java
@@ -0,0 +1,15 @@
+package com.github.pinont.singularitylib.api;
+
+import com.github.pinont.singularitylib.plugin.CorePlugin;
+
+public class Plugin extends CorePlugin {
+ @Override
+ public void onPluginStart() {
+ sendConsoleMessage("SingularityLib Plugin ready for hook!");
+ }
+
+ @Override
+ public void onPluginStop() {
+ sendConsoleMessage("SingularityLib Plugin stopped!");
+ }
+}
diff --git a/src/main/java/com/github/pinont/singularitylib/api/hook/discordJDA/DiscordApp.java b/src/main/java/com/github/pinont/singularitylib/api/hook/discordJDA/DiscordApp.java
index 66a3cd1..6cfb38e 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/hook/discordJDA/DiscordApp.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/hook/discordJDA/DiscordApp.java
@@ -5,6 +5,7 @@
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.events.session.ReadyEvent;
import org.bukkit.ChatColor;
+import org.bukkit.plugin.Plugin;
import java.util.ArrayList;
import java.util.Collections;
@@ -32,8 +33,8 @@ public abstract class DiscordApp {
*
* @param configPath the path to the bot configuration file
*/
- public DiscordApp(String configPath) {
- this(configPath, false);
+ public DiscordApp(Plugin plugin, String configPath) {
+ this(plugin, configPath, false);
}
/**
@@ -42,9 +43,9 @@ public DiscordApp(String configPath) {
* @param configPath the path to the bot configuration file
* @param multiThread whether to run the bot in a separate thread
*/
- public DiscordApp(String configPath, boolean multiThread) {
+ public DiscordApp(Plugin plugin, String configPath, boolean multiThread) {
this.configPath = configPath;
- configManager = new ConfigManager(configPath);
+ configManager = new ConfigManager(plugin, configPath);
this.multiThread = multiThread;
}
diff --git a/src/main/java/com/github/pinont/singularitylib/api/manager/ConfigManager.java b/src/main/java/com/github/pinont/singularitylib/api/manager/ConfigManager.java
index 51465e3..6c239c3 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/manager/ConfigManager.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/manager/ConfigManager.java
@@ -8,8 +8,6 @@
import java.io.File;
import java.io.IOException;
-import static com.github.pinont.singularitylib.plugin.CorePlugin.getInstance;
-
/**
* Manages configuration files for the plugin.
* This class provides functionality to create, load, save, and manipulate YAML configuration files.
@@ -19,7 +17,7 @@ public class ConfigManager {
private final File configFile;
private FileConfiguration config;
private final String fileName;
- private final Plugin plugin = getInstance();
+ private final Plugin plugin;
private boolean isFirstLoad;
/**
@@ -27,7 +25,8 @@ public class ConfigManager {
*
* @param fileName the name of the configuration file
*/
- public ConfigManager(String fileName) {
+ public ConfigManager(Plugin plugin, String fileName) {
+ this.plugin = plugin;
this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), fileName);
if (!configFile.exists()) {
@@ -51,8 +50,8 @@ public ConfigManager(String fileName) {
* @param fileName the name of the configuration file
* @return true if the file exists, false otherwise
*/
- public static boolean isExists(String subFolder, String fileName) {
- return new File(getInstance().getDataFolder() + "/" + subFolder, fileName).exists();
+ public static boolean isExists(Plugin plugin, String subFolder, String fileName) {
+ return new File(plugin.getDataFolder() + "/" + subFolder, fileName).exists();
}
/**
@@ -61,7 +60,8 @@ public static boolean isExists(String subFolder, String fileName) {
* @param subFolder the subfolder where the configuration file should be located
* @param fileName the name of the configuration file
*/
- public ConfigManager(String subFolder, String fileName) {
+ public ConfigManager(Plugin plugin, String subFolder, String fileName) {
+ this.plugin = plugin;
this.fileName = fileName;
configFile = new File(plugin.getDataFolder() + "/" + subFolder, fileName);
if (!configFile.exists()) {
diff --git a/src/main/java/com/github/pinont/singularitylib/api/manager/FileManager.java b/src/main/java/com/github/pinont/singularitylib/api/manager/FileManager.java
index 1da0143..547e2b2 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/manager/FileManager.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/manager/FileManager.java
@@ -1,6 +1,7 @@
package com.github.pinont.singularitylib.api.manager;
import com.github.pinont.singularitylib.plugin.CorePlugin;
+import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
@@ -19,12 +20,13 @@ public class FileManager {
/**
* The plugin instance for accessing the data folder.
*/
- public final JavaPlugin plugin = CorePlugin.getInstance();
+ public final Plugin plugin;
/**
* Default constructor for FileManager.
*/
- public FileManager() {
+ public FileManager(Plugin plugin) {
+ this.plugin = plugin;
}
/**
diff --git a/src/main/java/com/github/pinont/singularitylib/api/manager/WorldManager.java b/src/main/java/com/github/pinont/singularitylib/api/manager/WorldManager.java
index 7593b00..2c19f37 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/manager/WorldManager.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/manager/WorldManager.java
@@ -6,202 +6,202 @@
import java.util.Objects;
-import static com.github.pinont.singularitylib.plugin.CorePlugin.getInstance;
-
/**
* Manager class for creating, loading, and managing worlds.
* Provides functionality for world creation with custom settings and world persistence.
*/
public final class WorldManager {
- private final String worldName;
-
- private static final ConfigManager worldConfig = new ConfigManager("devTools", "worlds.yml");
-
- /**
- * Creates a new WorldManager for the specified world.
- *
- * @param worldName the name of the world to manage
- */
- public WorldManager(String worldName) {
- this.worldName = worldName;
- }
-
- /**
- * Creates a new world with the specified parameters.
- *
- * @param worldType the type of world to create
- * @param environment the environment type (normal, nether, end)
- * @param generateStructures whether to generate structures
- * @param borderSize the world border size
- * @param difficulty the world difficulty
- */
- public void create(WorldType worldType, World.Environment environment, boolean generateStructures, int borderSize, Difficulty difficulty) {
- WorldCreator worldCreator = new WorldCreator(worldName);
- worldCreator.type(worldType);
- worldCreator.generateStructures(generateStructures);
- worldCreator.environment(environment);
- createWorld(borderSize, difficulty, worldCreator);
- }
-
- /**
- * Creates a new world with the specified parameters including a custom seed.
- *
- * @param worldType the type of world to create
- * @param environment the environment type (normal, nether, end)
- * @param generateStructures whether to generate structures
- * @param borderSize the world border size
- * @param difficulty the world difficulty
- * @param seed the world seed for generation
- */
- public void create(WorldType worldType, World.Environment environment, boolean generateStructures, int borderSize, Difficulty difficulty, long seed) {
- WorldCreator worldCreator = new WorldCreator(worldName);
- worldCreator.type(worldType);
- worldCreator.generateStructures(generateStructures);
- worldCreator.environment(environment);
- worldCreator.seed(seed);
- createWorld(borderSize, difficulty, worldCreator);
- }
-
- private void createWorld(int borderSize, Difficulty difficulty, WorldCreator worldCreator) {
- World world = Bukkit.createWorld(worldCreator);
- assert world != null;
- world.setDifficulty(difficulty);
- world.setGameRuleValue("doMobSpawning", "false");
- WorldBorder border = world.getWorldBorder();
- border.setSize(borderSize);
- world.setMetadata("loader", new FixedMetadataValue(getInstance(), getInstance().getName()));
- setWorldConfig();
- }
-
- /**
- * Sets the world configuration in the config file.
- */
- public void setWorldConfig() {
- World world = Bukkit.getWorld(worldName);
- assert world != null;
- worldConfig.set(worldName + ".name", worldName);
- worldConfig.set(worldName + ".seed", world.getSeed());
- worldConfig.set(worldName + ".borderSize", world.getWorldBorder().getSize());
- worldConfig.set(worldName + ".worldType", Objects.requireNonNull(world.getWorldType()).getName());
- worldConfig.set(worldName + ".spawnLocation.world", Objects.requireNonNull(world.getSpawnLocation().getWorld()).getName());
- worldConfig.set(worldName + ".spawnLocation.x", world.getSpawnLocation().getX());
- worldConfig.set(worldName + ".spawnLocation.y", world.getSpawnLocation().getY());
- worldConfig.set(worldName + ".spawnLocation.z", world.getSpawnLocation().getZ());
- worldConfig.set(worldName + ".generateStructures", world.canGenerateStructures());
- worldConfig.set(worldName + ".environment", world.getEnvironment().getId());
- worldConfig.set(worldName + ".difficulty", world.getDifficulty().toString());
- for (String key : world.getGameRules()) {
- String value = world.getGameRuleValue(key);
- if (value != null) {
- worldConfig.set(worldName + ".gameRule." + key, value);
- }
- }
- worldConfig.saveConfig();
- }
-
- /**
- * Saves the world to disk.
- */
- public void saveWorld() {
- setWorldConfig();
- }
-
- /**
- * Loads a world by name.
- *
- * @param worldName the name of the world to load
- */
- public static void load(String worldName) {
- Bukkit.createWorld(WorldCreator.name(worldName));
- }
-
- /**
- * Unloads a world by name.
- *
- * @param worldName the name of the world to unload
- */
- public static void unload(String worldName) {
- World world = Bukkit.getWorld(worldName);
- if (world != null) {
- Bukkit.unloadWorld(world, true);
- }
- }
-
- /**
- * Deletes a world by name.
- *
- * @param worldName the name of the world to delete
- * @return true if the world was successfully marked for deletion, false otherwise
- */
- public static Boolean delete(String worldName) {
- World world = Bukkit.getWorld(worldName);
- if (worldConfig.get(worldName) != null) {
- if (world == null) {
- world = Bukkit.createWorld(WorldCreator.name(worldName));
- }
- assert world != null;
- world.removeMetadata("loader", getInstance());
- world.getWorldFolder().deleteOnExit();
- Bukkit.unloadWorld(world, false);
- } else {
- return false;
- }
- worldConfig.set(worldName, null);
- worldConfig.saveConfig();
- return true;
- }
-
- /**
- * Gets a world by name.
- *
- * @param worldName the name of the world to get
- * @return the World object, or null if not found
- */
- public static World getWorld(String worldName) {
- if (Bukkit.getWorld(worldName) == null && worldConfig.get(worldName) != null) {
- return Bukkit.createWorld(WorldCreator.name(worldName));
- }
- return null;
- }
-
- /**
- * Automatically loads worlds from configuration.
- */
- public static void autoLoadWorlds() {
- if (ConfigManager.isExists("devTools", "worlds.yml"))
- for (String worldName : worldConfig.getConfig().getKeys(false)) {
- load(worldName);
- World world = Bukkit.getWorld(worldName);
- assert world != null;
- world.setMetadata("loader", new FixedMetadataValue(getInstance(), getInstance().getName()));
- }
- }
-
- /**
- * Applies world settings from configuration to the specified world.
- *
- * @param world the world to apply settings to
- */
- public static void setWorldFromConfig(World world) {
- String worldName = world.getName();
- ConfigurationSection section = worldConfig.getConfig().getConfigurationSection(worldName);
- assert section != null;
- ConfigurationSection gameruleSection = section.getConfigurationSection("gameRule");
- world.getWorldBorder().setSize(section.getDouble("borderSize"));
- Location spawnLocation = new Location(
- Bukkit.getWorld(Objects.requireNonNull(section.getString("spawnLocation.world"))),
- section.getDouble("spawnLocation.x"),
- section.getDouble("spawnLocation.y"),
- section.getDouble("spawnLocation.z")
- );
- world.setSpawnLocation(spawnLocation);
- world.setDifficulty(Difficulty.valueOf(Objects.requireNonNull(section.getString("difficulty"))));
- for (String key : gameruleSection.getKeys(false)) {
- String value = gameruleSection.getString(key);
- if (value != null) {
- world.setGameRuleValue(key, value);
- }
- }
- }
+ // WIP: Move to Dev tool
+
+// private final String worldName;
+//
+// private static final ConfigManager worldConfig = new ConfigManager("devTools", "worlds.yml");
+//
+// /**
+// * Creates a new WorldManager for the specified world.
+// *
+// * @param worldName the name of the world to manage
+// */
+// public WorldManager(String worldName) {
+// this.worldName = worldName;
+// }
+//
+// /**
+// * Creates a new world with the specified parameters.
+// *
+// * @param worldType the type of world to create
+// * @param environment the environment type (normal, nether, end)
+// * @param generateStructures whether to generate structures
+// * @param borderSize the world border size
+// * @param difficulty the world difficulty
+// */
+// public void create(WorldType worldType, World.Environment environment, boolean generateStructures, int borderSize, Difficulty difficulty) {
+// WorldCreator worldCreator = new WorldCreator(worldName);
+// worldCreator.type(worldType);
+// worldCreator.generateStructures(generateStructures);
+// worldCreator.environment(environment);
+// createWorld(borderSize, difficulty, worldCreator);
+// }
+//
+// /**
+// * Creates a new world with the specified parameters including a custom seed.
+// *
+// * @param worldType the type of world to create
+// * @param environment the environment type (normal, nether, end)
+// * @param generateStructures whether to generate structures
+// * @param borderSize the world border size
+// * @param difficulty the world difficulty
+// * @param seed the world seed for generation
+// */
+// public void create(WorldType worldType, World.Environment environment, boolean generateStructures, int borderSize, Difficulty difficulty, long seed) {
+// WorldCreator worldCreator = new WorldCreator(worldName);
+// worldCreator.type(worldType);
+// worldCreator.generateStructures(generateStructures);
+// worldCreator.environment(environment);
+// worldCreator.seed(seed);
+// createWorld(borderSize, difficulty, worldCreator);
+// }
+//
+// private void createWorld(int borderSize, Difficulty difficulty, WorldCreator worldCreator) {
+// World world = Bukkit.createWorld(worldCreator);
+// assert world != null;
+// world.setDifficulty(difficulty);
+// world.setGameRuleValue("doMobSpawning", "false");
+// WorldBorder border = world.getWorldBorder();
+// border.setSize(borderSize);
+// world.setMetadata("loader", new FixedMetadataValue(getInstance(), getInstance().getName()));
+// setWorldConfig();
+// }
+//
+// /**
+// * Sets the world configuration in the config file.
+// */
+// public void setWorldConfig() {
+// World world = Bukkit.getWorld(worldName);
+// assert world != null;
+// worldConfig.set(worldName + ".name", worldName);
+// worldConfig.set(worldName + ".seed", world.getSeed());
+// worldConfig.set(worldName + ".borderSize", world.getWorldBorder().getSize());
+// worldConfig.set(worldName + ".worldType", Objects.requireNonNull(world.getWorldType()).getName());
+// worldConfig.set(worldName + ".spawnLocation.world", Objects.requireNonNull(world.getSpawnLocation().getWorld()).getName());
+// worldConfig.set(worldName + ".spawnLocation.x", world.getSpawnLocation().getX());
+// worldConfig.set(worldName + ".spawnLocation.y", world.getSpawnLocation().getY());
+// worldConfig.set(worldName + ".spawnLocation.z", world.getSpawnLocation().getZ());
+// worldConfig.set(worldName + ".generateStructures", world.canGenerateStructures());
+// worldConfig.set(worldName + ".environment", world.getEnvironment().getId());
+// worldConfig.set(worldName + ".difficulty", world.getDifficulty().toString());
+// for (String key : world.getGameRules()) {
+// String value = world.getGameRuleValue(key);
+// if (value != null) {
+// worldConfig.set(worldName + ".gameRule." + key, value);
+// }
+// }
+// worldConfig.saveConfig();
+// }
+//
+// /**
+// * Saves the world to disk.
+// */
+// public void saveWorld() {
+// setWorldConfig();
+// }
+//
+// /**
+// * Loads a world by name.
+// *
+// * @param worldName the name of the world to load
+// */
+// public static void load(String worldName) {
+// Bukkit.createWorld(WorldCreator.name(worldName));
+// }
+//
+// /**
+// * Unloads a world by name.
+// *
+// * @param worldName the name of the world to unload
+// */
+// public static void unload(String worldName) {
+// World world = Bukkit.getWorld(worldName);
+// if (world != null) {
+// Bukkit.unloadWorld(world, true);
+// }
+// }
+//
+// /**
+// * Deletes a world by name.
+// *
+// * @param worldName the name of the world to delete
+// * @return true if the world was successfully marked for deletion, false otherwise
+// */
+// public static Boolean delete(String worldName) {
+// World world = Bukkit.getWorld(worldName);
+// if (worldConfig.get(worldName) != null) {
+// if (world == null) {
+// world = Bukkit.createWorld(WorldCreator.name(worldName));
+// }
+// assert world != null;
+// world.removeMetadata("loader", getInstance());
+// world.getWorldFolder().deleteOnExit();
+// Bukkit.unloadWorld(world, false);
+// } else {
+// return false;
+// }
+// worldConfig.set(worldName, null);
+// worldConfig.saveConfig();
+// return true;
+// }
+//
+// /**
+// * Gets a world by name.
+// *
+// * @param worldName the name of the world to get
+// * @return the World object, or null if not found
+// */
+// public static World getWorld(String worldName) {
+// if (Bukkit.getWorld(worldName) == null && worldConfig.get(worldName) != null) {
+// return Bukkit.createWorld(WorldCreator.name(worldName));
+// }
+// return null;
+// }
+//
+// /**
+// * Automatically loads worlds from configuration.
+// */
+// public static void autoLoadWorlds() {
+// if (ConfigManager.isExists("devTools", "worlds.yml"))
+// for (String worldName : worldConfig.getConfig().getKeys(false)) {
+// load(worldName);
+// World world = Bukkit.getWorld(worldName);
+// assert world != null;
+// world.setMetadata("loader", new FixedMetadataValue(getInstance(), getInstance().getName()));
+// }
+// }
+//
+// /**
+// * Applies world settings from configuration to the specified world.
+// *
+// * @param world the world to apply settings to
+// */
+// public static void setWorldFromConfig(World world) {
+// String worldName = world.getName();
+// ConfigurationSection section = worldConfig.getConfig().getConfigurationSection(worldName);
+// assert section != null;
+// ConfigurationSection gameruleSection = section.getConfigurationSection("gameRule");
+// world.getWorldBorder().setSize(section.getDouble("borderSize"));
+// Location spawnLocation = new Location(
+// Bukkit.getWorld(Objects.requireNonNull(section.getString("spawnLocation.world"))),
+// section.getDouble("spawnLocation.x"),
+// section.getDouble("spawnLocation.y"),
+// section.getDouble("spawnLocation.z")
+// );
+// world.setSpawnLocation(spawnLocation);
+// world.setDifficulty(Difficulty.valueOf(Objects.requireNonNull(section.getString("difficulty"))));
+// for (String key : gameruleSection.getKeys(false)) {
+// String value = gameruleSection.getString(key);
+// if (value != null) {
+// world.setGameRuleValue(key, value);
+// }
+// }
+// }
}
\ No newline at end of file
diff --git a/src/main/java/com/github/pinont/singularitylib/api/ui/Menu.java b/src/main/java/com/github/pinont/singularitylib/api/ui/Menu.java
index 1d48db9..f942d1e 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/ui/Menu.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/ui/Menu.java
@@ -14,7 +14,6 @@
import java.util.Arrays;
import java.util.Objects;
-import static com.github.pinont.singularitylib.plugin.CorePlugin.getInstance;
import static com.github.pinont.singularitylib.plugin.CorePlugin.sendDebugMessage;
/**
@@ -141,7 +140,7 @@ public void show(Player player) {
inventory = Bukkit.createInventory(player, size, title);
}
- player.removeMetadata("Menu", getInstance());
+ player.removeMetadata("Menu", plugin);
if (!patternLayout.isEmpty()) {
for (int i = 0; i < patternLayout.size(); i++) {
String c = patternLayout.get(i);
@@ -197,13 +196,13 @@ public void onClick(Player player) {
}
}
if (player.hasMetadata("Menu")) {
- player.removeMetadata("Menu", getInstance());
+ player.removeMetadata("Menu", plugin);
player.closeInventory();
}
// Set metadata to prevent multiple instances
sendDebugMessage("Opening menu... " + getTitle());
player.openInventory(inventory);
- player.setMetadata("Menu", new FixedMetadataValue(getInstance(), this));
+ player.setMetadata("Menu", new FixedMetadataValue(plugin, this));
}
}
diff --git a/src/main/java/com/github/pinont/singularitylib/api/utils/MySQL.java b/src/main/java/com/github/pinont/singularitylib/api/utils/MySQL.java
index 2d54eaa..02dfac2 100644
--- a/src/main/java/com/github/pinont/singularitylib/api/utils/MySQL.java
+++ b/src/main/java/com/github/pinont/singularitylib/api/utils/MySQL.java
@@ -3,6 +3,7 @@
import com.github.pinont.singularitylib.api.manager.ConfigManager;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.plugin.Plugin;
import java.sql.Connection;
@@ -16,15 +17,17 @@
public class MySQL {
private Connection connection;
+ private Plugin plugin;
/**
* Default constructor for MySQL utility class.
*/
- public MySQL() {
+ public MySQL(Plugin plugin) {
+ this.plugin = plugin;
}
- private void defaultConfigSetup(String configPath) {
- ConfigManager configManager = new ConfigManager(configPath);
+ private void defaultConfigSetup(Plugin plugin, String configPath) {
+ ConfigManager configManager = new ConfigManager(plugin, configPath);
configManager.set("database.host", "localhost");
configManager.set("database.port", 3306);
configManager.set("database.databaseName", "database");
@@ -52,7 +55,7 @@ public Connection getConnection() {
* @return the database connection, or null if connection failed
*/
public Connection getConnection(String configPath) {
- ConfigManager configManager = new ConfigManager(configPath);
+ ConfigManager configManager = new ConfigManager(plugin, configPath);
FileConfiguration config = configManager.getConfig();
boolean database =
config.getString("database.host") == null ||
@@ -60,7 +63,7 @@ public Connection getConnection(String configPath) {
config.getString("database.username") == null || config.getString("database.password") == null ||
config.getString("database.timezone") == null || config.getString("database.useSSL") == null;
if (database) {
- defaultConfigSetup(configPath);
+ defaultConfigSetup(plugin, configPath);
return null;
}
String host = config.getString("database.host");
diff --git a/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java b/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java
index 1ab4d33..0704907 100644
--- a/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java
+++ b/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java
@@ -31,7 +31,7 @@ public CorePlugin() {
}
public @NotNull FileConfiguration getConfig() {
- return new ConfigManager("config.yml").getConfig();
+ return new ConfigManager(this, "config.yml").getConfig();
}
/**
@@ -40,7 +40,7 @@ public CorePlugin() {
* @return the ConfigManager instance for config.yml
*/
public @NotNull ConfigManager getConfigManager() {
- return new ConfigManager("config.yml");
+ return new ConfigManager(this, "config.yml");
}
private static String prefix;
@@ -99,8 +99,7 @@ public static void sendConsoleMessage(String message) {
* @return the API version string
*/
public static String getAPIVersion() {
- new ConfigManager("api-version.yml").saveConfig();
- String version = new ConfigManager("api-version.yml").getConfig().getString("version") == null ? "1.0.0" : new ConfigManager("api-version.yml").getConfig().getString("version");
+ String version = "1.3.0";
return "V-" + version;
}
@@ -159,7 +158,7 @@ public final void onEnable() {
instance = this;
prefix = getInstance().getPluginMeta().getLoggerPrefix();
// Initialize Plugin Config.
- pluginConfig = new ConfigManager("config.yml");
+ pluginConfig = new ConfigManager(this, "config.yml");
if (pluginConfig.isFirstLoad()) {
pluginConfig.set("debug", false);
pluginConfig.saveConfig();
diff --git a/src/main/resources/paper-plugin.yml b/src/main/resources/paper-plugin.yml
index 465582b..1e9f98e 100644
--- a/src/main/resources/paper-plugin.yml
+++ b/src/main/resources/paper-plugin.yml
@@ -1,8 +1,8 @@
name: SingularityLib
version: '1.0-SNAPSHOT'
-main: com.github.pinont.singularitylib.plugin.CorePlugin
+main: com.github.pinont.singularitylib.api.Plugin
api-version: '1.21'
-prefix: Singularity
+prefix: SingularityLib
load: STARTUP
description: A plugin library for Singularity Plugins
author: Pinont
\ No newline at end of file