Skip to content

Commit

Permalink
Added Update Checking, bStats, and Organization Attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguycy committed Jan 17, 2024
1 parent 4382b12 commit 81549c9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public List<String> onTabComplete(CommandSender sender, Command command, String
if (args.length == 3) { // When typing the organization name
return getListOfOrgNames();
} else if (args.length == 4) { // When typing the attribute
return getListOfOrgAttributes(args);
return getListOfOrgAttributes();
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.object.Resident;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Random;

import static com.palmergames.bukkit.towny.TownyEconomyHandler.setupEconomy;
Expand Down Expand Up @@ -59,6 +63,7 @@ public void onEnable() {
getLogger().info(" Craft complex worlds and shape geopolitical adventures!");
getLogger().info("=============================================================");
}
checkForUpdates();
this.getCommand("wde").setExecutor(new WDECommandExecutor(nationManager, organizationManager, getEconomy()));
this.getCommand("wde").setTabCompleter(new WDETabCompleter(organizationManager));
startGovernmentAutoSaveTask();
Expand Down Expand Up @@ -137,4 +142,29 @@ private boolean setupEconomy() {
public static Economy getEconomy() {
return economy;
}
private void checkForUpdates() {
try {
URL url = new URL("https://raw.githubusercontent.com/thatguycy/WorldDynamics-Engine/master/current.version"); // URL to your version file
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");

BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String latestVersion = in.readLine();
in.close();

String currentVersion = this.getDescription().getVersion();
if (!currentVersion.equals(latestVersion)) {
getLogger().info("=============================================================");
getLogger().info(" WorldDynamics Engine is out of date!");
getLogger().info(" Your Version: " + currentVersion);
getLogger().info(" Our Version: " + latestVersion);
getLogger().info(" Update: https://github.com/thatguycy/WorldDynamics-Engine");
getLogger().info(" Craft complex worlds and shape geopolitical adventures!");
getLogger().info("=============================================================");
}
} catch (Exception e) {
getLogger().warning("Failed to check for updates: " + e.getMessage());
}
}

}
Binary file not shown.
2 changes: 1 addition & 1 deletion target/classes/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: WorldDynamicsEngine
version: '0.1.3'
version: '0.1.4'
main: com.thatguycy.worlddynamicsengine.WorldDynamicsEngine
api-version: '1.20'
softdepend: [Towny, Vault]
Expand Down
2 changes: 1 addition & 1 deletion target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
artifactId=WorldDynamicsEngine
groupId=com.thatguycy
version=0.1.3
version=0.1.4
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
com\thatguycy\worlddynamicsengine\OrganizationProperties$OrganizationAttribute.class
com\thatguycy\worlddynamicsengine\WorldDynamicsEngine$1.class
com\thatguycy\worlddynamicsengine\NationManager.class
com\thatguycy\worlddynamicsengine\NationProperties.class
Expand Down

0 comments on commit 81549c9

Please sign in to comment.