-
Notifications
You must be signed in to change notification settings - Fork 0
Bump to Version 1.3.2 for Plugin Library Only Stuff #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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!"); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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); | ||
|
Comment on lines
+46
to
+48
|
||
| this.multiThread = multiThread; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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,15 +17,16 @@ 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; | ||
|
|
||
| /** | ||
| * Creates a ConfigManager for a configuration file in the plugin's data folder. | ||
| * | ||
| * @param fileName the name of the configuration file | ||
| */ | ||
| public ConfigManager(String fileName) { | ||
| public ConfigManager(Plugin plugin, String fileName) { | ||
| this.plugin = plugin; | ||
|
Comment on lines
+28
to
+29
|
||
| 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(); | ||
|
Comment on lines
+53
to
+54
|
||
| } | ||
|
|
||
| /** | ||
|
|
@@ -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; | ||
|
Comment on lines
+63
to
+64
|
||
| this.fileName = fileName; | ||
| configFile = new File(plugin.getDataFolder() + "/" + subFolder, fileName); | ||
| if (!configFile.exists()) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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. | ||||||||||
|
||||||||||
| * Default constructor for FileManager. | |
| * Default constructor for FileManager. | |
| * | |
| * @param plugin the plugin instance for accessing the data folder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constructor's Javadoc at line 32-35 does not document the newly added
pluginparameter. The documentation should be updated to include@param plugin the plugin instance.