Skip to content

Commit

Permalink
Create bStats metric reporting
Browse files Browse the repository at this point in the history
Create version checking to notify of updates
  • Loading branch information
IanTapply22 committed Feb 6, 2025
1 parent bee106a commit dfd11cd
Show file tree
Hide file tree
Showing 6 changed files with 1,024 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/com/iantapply/wynncraft/Wynncraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

import com.iantapply.wynncraft.command.CommandCore;
import com.iantapply.wynncraft.configuration.ConfigurationCore;
import com.iantapply.wynncraft.configuration.PluginConfigurations;
import com.iantapply.wynncraft.database.DatabaseCore;
import com.iantapply.wynncraft.event.PlayerJoinEvent;
import com.iantapply.wynncraft.logger.Logger;
import com.iantapply.wynncraft.metrics.Metrics;
import com.iantapply.wynncraft.metrics.UpdateChecker;
import com.iantapply.wynncraft.nbs.NBSCore;
import lombok.Getter;
import org.bukkit.Bukkit;
Expand All @@ -18,6 +21,8 @@ public final class Wynncraft extends JavaPlugin {
@Getter
public ConfigurationCore configurationCore;
@Getter
public UpdateChecker updateChecker;
@Getter
public NBSCore nbsCore;

@Override
Expand All @@ -40,6 +45,11 @@ public void onEnable() {

Bukkit.getServer().getPluginManager().registerEvents(new PlayerJoinEvent(), this);

new Metrics(this, PluginConfigurations.BSTATS_PLUGIN_ID);

this.updateChecker = new UpdateChecker(this, PluginConfigurations.BSTATS_PLUGIN_ID);
this.updateChecker.check();

Logger.logStartup();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class PluginConfigurations {
public static final String DEVELOPER_CREDITS = "iantapply";
public static final String DESCRIPTION = "A Wynncraft recreation";
public static final String MAIN_CONFIG_FILE = "config.yml";
public static final int BSTATS_PLUGIN_ID = 24674;

/**
* Checks if the server and plugin are running in PaperMC mode
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/iantapply/wynncraft/logger/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,22 @@ public static void logStartup() {
log(LoggingLevel.INFO, "Developers: " + PluginConfigurations.DEVELOPER_CREDITS);
}

/**
* Logs an update notification to the Bukkit console
*/
public static void logUpdateNotificationConsole() {
log(LoggingLevel.INFO,"A new update is available for " + PluginConfigurations.NAME + " plugin");
log(LoggingLevel.INFO, "You can find the update at: https://hangar.papermc.io/GucciFox/Wynncraft");
}

/**
* Logs an unreleased plugin version notification to the Bukkit console
*/
public static void logUnreleasedVersionNotification() {
log(LoggingLevel.INFO, "The version for the " + PluginConfigurations.NAME + " plugin is higher than latest version");
log(LoggingLevel.INFO, "You are currently running an unreleased version of the plugin that is NOT stable");
}

/**
* Logs a shutdown message to the Bukkit console
*/
Expand Down
Loading

0 comments on commit dfd11cd

Please sign in to comment.