Skip to content

Commit

Permalink
Removed update checker, kept debug current version data output
Browse files Browse the repository at this point in the history
  • Loading branch information
toydotgame committed Feb 12, 2021
1 parent 1270e91 commit 03f70b8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
2 changes: 1 addition & 1 deletion plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Thisway
main: io.github.Toydotgame.Main
version: 1.2.2
version: 1.2.3
description: Teleports the player in the direction they're facing.
author: Toydotgam
prefix: Thisway
Expand Down
1 change: 0 additions & 1 deletion src/io/github/Toydotgame/DataStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

public class DataStorage {
public static String localVersion;
public static String serverVersion;

public static boolean debug;
public static String facing;
Expand Down
21 changes: 2 additions & 19 deletions src/io/github/Toydotgame/Main.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
package io.github.Toydotgame;

import java.util.concurrent.CompletableFuture;

import org.bukkit.plugin.java.JavaPlugin;

import me.robertlit.spigotresources.api.Resource;
import me.robertlit.spigotresources.api.SpigotResourcesAPI;

public class Main extends JavaPlugin {
@Override
public void onEnable() {
SpigotResourcesAPI api = new SpigotResourcesAPI(false);

CompletableFuture<Resource> future = api.getResource(87115);
future.thenAccept(resource -> {
DataStorage.localVersion = this.getDescription().getVersion();
DataStorage.serverVersion = resource.getVersion();

if(this.getDescription().getVersion().equals(resource.getVersion())) { // if(localVersion == serverVersion) {}
System.out.print("[Thisway] Plugin loaded successfully!");
} else {
System.out.print("[Thisway] Thisway is out-of-date or you are using a beta version of the plugin. If it's the former; I strongly suggest that you update in case of any potential bugs in your copy of the plugin.");
System.out.print("[Thisway] The plugin was loaded anyway.");
}
});
DataStorage.localVersion = this.getDescription().getVersion();
System.out.print("[Thisway] Plugin loaded successfully!");
this.getCommand("thisway").setExecutor(new Thisway());
}

Expand Down
11 changes: 3 additions & 8 deletions src/io/github/Toydotgame/Thisway.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,13 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if(args[1].equalsIgnoreCase("true")) { // If the second argument is "true':
if(args[0].matches("^[0-9]*$") && args[0] != "0") { // If the first argument is an accepted number.
DataStorage.debug = true;
sender.sendMessage(ChatColor.YELLOW + "=== THISWAY DEBUG START ==="); // Debug header in player chat.

sender.sendMessage(ChatColor.YELLOW + "=== THISWAY DEBUG START ==="); // Debug header in player chat.
sender.sendMessage("Plugin version: " + DataStorage.localVersion);
sender.sendMessage("Latest Version: " + DataStorage.serverVersion);
if(DataStorage.localVersion.equals(DataStorage.serverVersion)) {
sender.sendMessage(ChatColor.GREEN + "Thisway is up-to-date.");
} else {
sender.sendMessage(ChatColor.RED + "Thisway is not up-to-date with the latest stable version!");
}

sender.sendMessage(/* ChatColor.GREY + */ "Always remember to check for updates!");
thisway(sender, args);
sender.sendMessage(ChatColor.YELLOW + "=== THISWAY DEBUG END ==="); // Debug footer.

return true;
} else {
sender.sendMessage(ChatColor.RED + "Invalid teleportation distance! Not a number!");
Expand Down

0 comments on commit 03f70b8

Please sign in to comment.