Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 23 additions & 32 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.github.pinont</groupId>
<artifactId>singularitylib</artifactId>
<version>1.3.0-SNAPSHOT</version>
<version>1.3.2-SNAPSHOT</version>
<packaging>jar</packaging>

<name>SingularityLib</name>
Expand Down Expand Up @@ -131,46 +131,37 @@
</executions>
</plugin>

<!-- Explicit deploy plugin version -->
<!-- Shade -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>


<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
<version>2.1.1</version>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<configuration>
<filters>
<filter>
<artifact>org.reflections:reflections</artifact>
<includes>
<include>org/reflections/**</include>
</includes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<phase>package</phase>
<goals>
<goal>execute</goal>
<goal>shade</goal>
</goals>
<configuration>
<source>
// 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
}
}
</source>
</configuration>
</execution>
</executions>
</plugin>

<!-- Explicit deploy plugin version -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>

<resources>
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/com/github/pinont/singularitylib/api/Plugin.java
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
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Comment on lines +36 to +37
Copy link

Copilot AI Nov 6, 2025

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 plugin parameter. The documentation should be updated to include @param plugin the plugin instance.

Copilot uses AI. Check for mistakes.
}

/**
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 40-45 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance.

Copilot uses AI. Check for mistakes.
this.multiThread = multiThread;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 24-27 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.

Copilot uses AI. Check for mistakes.
this.fileName = fileName;
configFile = new File(plugin.getDataFolder(), fileName);
if (!configFile.exists()) {
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method's Javadoc at line 46-52 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.

Copilot uses AI. Check for mistakes.
}

/**
Expand All @@ -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
Copy link

Copilot AI Nov 6, 2025

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 58-62 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.

Copilot uses AI. Check for mistakes.
this.fileName = fileName;
configFile = new File(plugin.getDataFolder() + "/" + subFolder, fileName);
if (!configFile.exists()) {
Expand Down
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;
Expand All @@ -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.
Copy link

Copilot AI Nov 6, 2025

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 26-27 does not document the newly added plugin parameter. The documentation should be updated to include @param plugin the plugin instance for accessing the data folder.

Suggested change
* Default constructor for FileManager.
* Default constructor for FileManager.
*
* @param plugin the plugin instance for accessing the data folder

Copilot uses AI. Check for mistakes.
*/
public FileManager() {
public FileManager(Plugin plugin) {
this.plugin = plugin;
}

/**
Expand Down
Loading