Skip to content

Commit

Permalink
Added Update-Checker setting and Cleanup Code
Browse files Browse the repository at this point in the history
  • Loading branch information
rdpPrivate committed Mar 4, 2022
1 parent 0955620 commit 074d0b5
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.rdproject.waterhub</groupId>
<artifactId>WaterHub</artifactId>
<version>1.3-HOTFIX</version>
<version>1.4-HOTFIX</version>
<packaging>jar</packaging>

<name>WaterHub</name>
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/com/rdproject/waterhub/plugin/HubListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public void onChat(ChatEvent e) {
if (!player.getServer().getInfo().getName().equals(lobbyServer)) {
e.setCancelled(true);
player.connect(sv);
player.sendMessage(formatComponent(PREFIX + Connected.replace("&", "§")));
player.sendMessage(formatComponent(PREFIX + Connected));
} else {
player.sendMessage(formatComponent(PREFIX + MSGAlreadyCon.replace("&", "§")));
player.sendMessage(formatComponent(PREFIX + MSGAlreadyCon));
}
} else {
player.sendMessage(formatComponent(PREFIX + MSGDisServer.replace("&", "§")));
player.sendMessage(formatComponent(PREFIX + MSGDisServer));
}
e.setCancelled(true);
}
Expand Down
41 changes: 22 additions & 19 deletions src/main/java/com/rdproject/waterhub/plugin/LoaderUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,26 +38,29 @@ public static void LoadConfig() {

public static void LoadUtils() {
new Metrics(plugin, 14208);
UpdateChecker updateChecker = new UpdateChecker(plugin, 99826);
try {
if (updateChecker.checkForUpdates()) {
log.info(LIST);
log.info(" §8• §bWaterHub §8•");
log.info("");
log.info("§8× §7Update Available!");
log.info("§8× §7Download it from Spigot!");
log.info("");
log.info(LIST);
} else {
log.info(LIST);
log.info(" §8• §bWaterHub §8•");
log.info("");
log.info("§8× §7You are using the Latest Version!");
log.info("");
log.info(LIST);
Boolean checkupdates = cg.getBoolean("Check-Updates");
if (Boolean.TRUE.equals(checkupdates)) {
UpdateChecker updateChecker = new UpdateChecker(plugin, 99826);
try {
if (updateChecker.checkForUpdates()) {
log.info(LIST);
log.info(" §8• §bWaterHub §8•");
log.info("");
log.info("§8× §7Update Available!");
log.info("§8× §7Download it from Spigot!");
log.info("");
log.info(LIST);
} else {
log.info(LIST);
log.info(" §8• §bWaterHub §8•");
log.info("");
log.info("§8× §7You are using the Latest Version!");
log.info("");
log.info(LIST);
}
} catch (Exception e) {
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ConstantsUtil {

public static Configuration cg;
public static @Getter WaterHub plugin;
public static final String VERSION = "1.3-HOTFIX";
public static final String VERSION = "1.4-HOTFIX";
public static final String LIST = "§8§l----------------------------";
public static final String STARTUP_MESSAGE = "\n" + " \\ \\ / | | | | \n" +
" \\ \\ \\ / _` | __| _ \\ __| | | | | __ \\ \n" +
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/bungee.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: WaterHub
main: com.rdproject.waterhub.WaterHub
version: 1.3-HOTFIX
version: 1.4-HOTFIX
author: RDProject
description: Useful Hub System
website: https://github.com/RDProjectOfficial
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Prefix: "§8• §bWaterHub §8× "
NoPermission: "§bYou do not have permission!"
Config-Reloaded: "§bConfiguration successfully reloaded!"
Check-Updates: true

#Messages
ConnectedServer: '§bYou are connecting to the Lobby...'
Expand Down

0 comments on commit 074d0b5

Please sign in to comment.