Skip to content

Commit

Permalink
Merge pull request #26 from variananora/rc-27-update
Browse files Browse the repository at this point in the history
Updated all namings to new the one
  • Loading branch information
TheBusyBiscuit authored Sep 6, 2021
2 parents 31cd2ac + b01b591 commit 1b6223f
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 51 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<groupId>com.github.thebusybiscuit</groupId>
<artifactId>Slimefun4</artifactId>
<version>326a431151</version>
<version>RC-27</version>
<scope>provided</scope>
</dependency>

Expand Down
18 changes: 9 additions & 9 deletions src/main/java/dev/walshy/sfmetrics/MetricsModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import dev.walshy.sfmetrics.charts.SlimefunVersionChart;
import dev.walshy.sfmetrics.charts.TickRateChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

public class MetricsModule {

Expand All @@ -45,10 +45,10 @@ public class MetricsModule {
private MetricsModule() {}

public static void start() {
Metrics metrics = new Metrics(SlimefunPlugin.instance(), PLUGIN_ID);
branch = SlimefunPlugin.getUpdater().getBranch();
slimefunVersion = SlimefunPlugin.getUpdater().getBuildNumber();
metricsAutoUpdates = SlimefunPlugin.getMetricsService().hasAutoUpdates();
Metrics metrics = new Metrics(Slimefun.instance(), PLUGIN_ID);
branch = Slimefun.getUpdater().getBranch();
slimefunVersion = Slimefun.getUpdater().getBuildNumber();
metricsAutoUpdates = Slimefun.getMetricsService().hasAutoUpdates();

addChart(metrics, AutoUpdaterChart::new);
addChart(metrics, ResourcePackChart::new);
Expand All @@ -70,8 +70,8 @@ public static void start() {
addChart(metrics, DisabledItemsChart::new);
addChart(metrics, AverageTimingsChart::new);

SlimefunPlugin.instance().getLogger().log(Level.INFO, "Now running MetricsModule build #{0}", VERSION);
SlimefunPlugin.instance().getLogger().log(Level.INFO, "with a total of {0}/{1} chart(s)!", new Object[] { enabledCharts, totalCharts });
Slimefun.instance().getLogger().log(Level.INFO, "Now running MetricsModule build #{0}", VERSION);
Slimefun.instance().getLogger().log(Level.INFO, "with a total of {0}/{1} chart(s)!", new Object[] { enabledCharts, totalCharts });
}

@ParametersAreNonnullByDefault
Expand Down Expand Up @@ -100,9 +100,9 @@ private static <T extends CustomChart & SlimefunMetricsChart> void addChart(Metr
@ParametersAreNonnullByDefault
private static void warn(String chartName, Throwable x) {
if (!metricsAutoUpdates) {
SlimefunPlugin.instance().getLogger().log(Level.WARNING, "Turn on Auto-Updates for Slimefun-Metrics to avoid this issue!");
Slimefun.instance().getLogger().log(Level.WARNING, "Turn on Auto-Updates for Slimefun-Metrics to avoid this issue!");
}

SlimefunPlugin.instance().getLogger().log(Level.WARNING, x, () -> "Failed to load bStats Chart \"" + chartName + "\" for Metrics #" + VERSION);
Slimefun.instance().getLogger().log(Level.WARNING, x, () -> "Failed to load bStats Chart \"" + chartName + "\" for Metrics #" + VERSION);
}
}
4 changes: 2 additions & 2 deletions src/main/java/dev/walshy/sfmetrics/charts/AddonsChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunAddon;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -29,7 +29,7 @@ public AddonsChart() {
super("installed_addons", () -> {
Map<String, Integer> addons = new HashMap<>();

for (Plugin plugin : SlimefunPlugin.getInstalledAddons()) {
for (Plugin plugin : Slimefun.getInstalledAddons()) {
if (plugin.isEnabled()) {
addons.put(plugin.getName(), 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import dev.walshy.sfmetrics.VersionDependentChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

/**
* This {@link SimplePie} shows us how many {@link Server Servers} have enabled or disabled
Expand All @@ -23,7 +23,7 @@ public class AutoUpdaterChart extends SimplePie implements VersionDependentChart

public AutoUpdaterChart() {
super("auto_updates", () -> {
boolean enabled = SlimefunPlugin.getUpdater().isEnabled();
boolean enabled = Slimefun.getUpdater().isEnabled();
return enabled ? "enabled" : "disabled";
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dev.walshy.sfmetrics.VersionDependentChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bstats.charts.SimplePie;
import org.bstats.json.JsonObjectBuilder;

Expand All @@ -16,7 +16,7 @@ public AverageTimingsChart() {
super("average_timings", () -> {
long averageMsTiming = 0;
try {
averageMsTiming = SlimefunPlugin.getProfiler().getAndResetAverageTimings();
averageMsTiming = Slimefun.getProfiler().getAndResetAverageTimings();
} catch (ArithmeticException e) {
// I forgot we test this on startup when the timing would be 0.
// This is a quick and dirty fix - thank god for easy module stuff
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dev/walshy/sfmetrics/charts/CommandChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bstats.charts.AdvancedPie;
import org.bstats.json.JsonObjectBuilder;

Expand All @@ -25,7 +25,7 @@ public CommandChart() {
super("commands_ran", () -> {
Map<String, Integer> commands = new HashMap<>();

for (Map.Entry<SubCommand, Integer> entry : SlimefunPlugin.getCommand().getCommandUsage().entrySet()) {
for (Map.Entry<SubCommand, Integer> entry : Slimefun.getCommand().getCommandUsage().entrySet()) {
commands.put("/sf " + entry.getKey().getName(), entry.getValue());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package dev.walshy.sfmetrics.charts;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bstats.charts.SimplePie;
import org.bstats.json.JsonObjectBuilder;
import org.bukkit.Server;
Expand All @@ -18,7 +18,7 @@ public class CompatibilityModeChart extends SimplePie implements SlimefunMetrics

public CompatibilityModeChart() {
super("compatibility_mode", () -> {
boolean enabled = SlimefunPlugin.getRegistry().isBackwardsCompatible();
boolean enabled = Slimefun.getRegistry().isBackwardsCompatible();
return enabled ? "enabled" : "disabled";
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.walshy.sfmetrics.charts;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItem;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bstats.charts.AdvancedPie;
import org.bstats.json.JsonObjectBuilder;
import org.bukkit.Server;
Expand Down Expand Up @@ -50,8 +50,8 @@ public JsonObjectBuilder.JsonObject getDataSample() throws Exception {
private static void fetchItems() {
new Thread(() -> {
disabledItems = new HashMap<>();
for (SlimefunItem item : SlimefunPlugin.getRegistry().getAllSlimefunItems()) {
if (item.getAddon().equals(SlimefunPlugin.instance()) && item.isDisabled()) {
for (SlimefunItem item : Slimefun.getRegistry().getAllSlimefunItems()) {
if (item.getAddon().equals(Slimefun.instance()) && item.isDisabled()) {
disabledItems.put(item.getId(), 1);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.bukkit.plugin.PluginManager;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

/**
* This {@link AdvancedPie} shows us which {@link Plugin Plugins} the current
Expand All @@ -26,7 +26,7 @@ public class IntegrationsChart extends AdvancedPie implements SlimefunMetricsCha

public IntegrationsChart() {
super("integrations", () -> {
SlimefunPlugin slimefun = SlimefunPlugin.instance();
Slimefun slimefun = Slimefun.instance();
Map<String, Integer> plugins = new HashMap<>();

// Hard dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import dev.walshy.sfmetrics.MetricsModule;
import dev.walshy.sfmetrics.VersionDependentChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

/**
* This {@link SimplePie} shows us whether a {@link Server} has enabled or disabled
Expand All @@ -22,7 +22,7 @@ public class MetricsAutoUpdatesChart extends SimplePie implements VersionDepende

public MetricsAutoUpdatesChart() {
super("metrics_auto_updates", () -> {
boolean enabled = SlimefunPlugin.getMetricsService().hasAutoUpdates();
boolean enabled = Slimefun.getMetricsService().hasAutoUpdates();
return enabled ? "enabled" : "disabled";
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dev.walshy.sfmetrics.VersionDependentChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

/**
* This single line graph shows the amount of {@link Server Servers} that installed
Expand All @@ -28,7 +28,7 @@ public class NewServersChart extends SingleLineChart implements VersionDependent

public NewServersChart() {
super("new_servers", () -> {
boolean newServer = SlimefunPlugin.isNewlyInstalled();
boolean newServer = Slimefun.isNewlyInstalled();
return newServer ? 1 : 0;
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -28,8 +28,8 @@ public PlayerLanguageChart() {
Map<String, Integer> languages = new HashMap<>();

for (Player p : Bukkit.getOnlinePlayers()) {
Language language = SlimefunPlugin.getLocalization().getLanguage(p);
boolean supported = SlimefunPlugin.getLocalization().isLanguageLoaded(language.getId());
Language language = Slimefun.getLocalization().getLanguage(p);
boolean supported = Slimefun.getLocalization().isLanguageLoaded(language.getId());

String lang = supported ? language.getId() : "Unsupported Language";
languages.merge(lang, 1, Integer::sum);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.bukkit.Server;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.core.researching.Research;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.api.researches.Research;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -21,7 +21,7 @@ public class ResearchesEnabledChart extends SimplePie implements SlimefunMetrics

public ResearchesEnabledChart() {
super("servers_with_researches_enabled", () -> {
boolean enabled = SlimefunPlugin.getRegistry().isFreeCreativeResearchingEnabled();
boolean enabled = Slimefun.getRegistry().isFreeCreativeResearchingEnabled();
return enabled ? "enabled" : "disabled";
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.bukkit.Server;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -20,11 +20,11 @@ public class ResourcePackChart extends SimplePie implements SlimefunMetricsChart

public ResourcePackChart() {
super("resourcepack", () -> {
String version = SlimefunPlugin.getItemTextureService().getVersion();
String version = Slimefun.getItemTextureService().getVersion();

if (version != null && version.startsWith("v")) {
return version + " (Official)";
} else if (SlimefunPlugin.getItemTextureService().isActive()) {
} else if (Slimefun.getItemTextureService().isActive()) {
return "Custom / Modified";
} else {
return "None";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -21,8 +21,8 @@ public class ServerLanguageChart extends SimplePie implements SlimefunMetricsCha

public ServerLanguageChart() {
super("language", () -> {
Language language = SlimefunPlugin.getLocalization().getDefaultLanguage();
boolean supported = SlimefunPlugin.getLocalization().isLanguageLoaded(language.getId());
Language language = Slimefun.getLocalization().getDefaultLanguage();
boolean supported = Slimefun.getLocalization().isLanguageLoaded(language.getId());
return supported ? language.getId() : "Unsupported Language";
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.api.SlimefunBranch;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;

import javax.annotation.Nonnull;

Expand All @@ -28,8 +28,8 @@ public SlimefunVersionChart() {
Map<String, Map<String, Integer>> outerMap = new HashMap<>();
Map<String, Integer> innerMap = new HashMap<>();

innerMap.put(SlimefunPlugin.getVersion(), 1);
outerMap.put(SlimefunPlugin.getUpdater().getBranch().getName(), innerMap);
innerMap.put(Slimefun.getVersion(), 1);
outerMap.put(Slimefun.getUpdater().getBranch().getName(), innerMap);

return outerMap;
});
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/dev/walshy/sfmetrics/charts/TickRateChart.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Map;

import dev.walshy.sfmetrics.SlimefunMetricsChart;
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
import io.github.thebusybiscuit.slimefun4.implementation.Slimefun;
import org.bstats.charts.DrilldownPie;
import org.bstats.json.JsonObjectBuilder;

Expand All @@ -22,9 +22,9 @@ public class TickRateChart extends DrilldownPie implements SlimefunMetricsChart
public TickRateChart() {
super("tick_rate", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
int tickRate = SlimefunPlugin.getTickerTask().getTickRate();
int armorTickRate = SlimefunPlugin.getCfg().getInt("options.armor-update-interval");
int cargoDelay = SlimefunPlugin.getCfg().getInt("networks.cargo-ticker-delay");
int tickRate = Slimefun.getTickerTask().getTickRate();
int armorTickRate = Slimefun.getCfg().getInt("options.armor-update-interval");
int cargoDelay = Slimefun.getCfg().getInt("networks.cargo-ticker-delay");

// For normal blocks the tick-rate will be taken literal
Map<String, Integer> normal = new HashMap<>();
Expand Down

0 comments on commit 1b6223f

Please sign in to comment.