Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Merge pull request #18 from ProjectG-Plugins/1.2.1
Browse files Browse the repository at this point in the history
don't disable when failing to load git.properties
  • Loading branch information
Konicai authored Jul 3, 2021
2 parents b96eb02 + 89b9c73 commit 6b58049
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/main/java/dev/projectg/geyserhub/GeyserHubMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,20 @@ public void onEnable() {
new Metrics(this, 11427);
// getting the logger forces the config to load before our loadConfiguration() is called...
SelectorLogger logger = SelectorLogger.getLogger();
if (!Bukkit.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
logger.warn("This plugin works best with PlaceholderAPI! Since you don't have it installed, only %player_name% and %player_uuid% will work in the GeyserHub config!");
}

try {
Properties gitProperties = new Properties();
gitProperties.load(FileUtils.getResource("git.properties"));
logger.info("Branch: " + gitProperties.getProperty("git.branch", "Unknown") + ", Commit: " + gitProperties.getProperty("git.commit.id.abbrev", "Unknown"));
} catch (IOException e) {
} catch (IOException | NullPointerException | IllegalArgumentException e) {
logger.warn("Unable to load resource: git.properties");
e.printStackTrace();
}

if (!Bukkit.getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) {
logger.warn("This plugin works best with PlaceholderAPI! Since you don't have it installed, only %player_name% and %player_uuid% will work in the GeyserHub config!");
}

configManager = new ConfigManager();
if (!configManager.loadAllConfigs()) {
logger.severe("Disabling due to configuration error.");
Expand Down
8 changes: 3 additions & 5 deletions src/main/java/dev/projectg/geyserhub/utils/FileUtils.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
package dev.projectg.geyserhub.utils;

import javax.annotation.Nullable;
import java.io.InputStream;

public class FileUtils {

@Nullable
public static InputStream getResource(String resource) {
InputStream stream = FileUtils.class.getClassLoader().getResourceAsStream(resource);
if (stream == null) {
throw new AssertionError("Unable to find resource: " + resource);
}
return stream;
return FileUtils.class.getClassLoader().getResourceAsStream(resource);
}
}

0 comments on commit 6b58049

Please sign in to comment.