Skip to content

Commit

Permalink
Fix errors when migrating
Browse files Browse the repository at this point in the history
  • Loading branch information
heychazza committed Mar 12, 2024
1 parent 145ffeb commit f395fb7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
defaultTasks("clean", "shadowJar")

group = "io.tebex.analytics"
version = "2.2.0"
version = "2.2.1"

subprojects {
plugins.apply("java")
Expand Down
7 changes: 7 additions & 0 deletions bukkit/src/main/java/io/tebex/analytics/AnalyticsPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,17 @@ public void onEnable() {
// Check if the server has been set up.
if (config.getServerToken() != null && !config.getServerToken().isEmpty()) {
sdk.getServerInformation().thenAccept(serverInformation -> {
if(! isSetup()) return;

log("Connected to " + serverInformation.getName() + ".");
configure();
}).exceptionally(ex -> {
Throwable cause = ex.getCause();

if (cause.getMessage().contains("zip file closed")) {
return null;
}

if(cause instanceof ServerNotFoundException) {
warning("Failed to connect. Please double-check your server key or run the setup command again.");
this.halt();
Expand Down Expand Up @@ -184,6 +190,7 @@ public void onEnable() {
@Override
public void onDisable() {
unloadModules();
setup = false;
}

private void checkForUpdates() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public HeartbeatManager(AnalyticsPlugin platform) {

public void start() {
task = platform.getScheduler().globalRegionalScheduler().runAtFixedRate(() -> {
if(! platform.isSetup()) return;

int playerCount = Bukkit.getOnlinePlayers().size();

if(playerCount == 0) {
Expand Down

0 comments on commit f395fb7

Please sign in to comment.