Skip to content

Commit

Permalink
1.2.3 release:
Browse files Browse the repository at this point in the history
- warn about null translations (should never happen, but what do i know)
- better error printing
- log version that's used in the log
  • Loading branch information
onebeastchris committed Dec 30, 2023
1 parent 4c84bd2 commit 6359d0a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group 'net.onebeastchris.geyser.extension'
version '1.2.1'
version '1.2.3'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import java.util.List;

public class PickPack implements Extension {

private static final String version = "(v1.2.3)";

public static ResourcePackLoader loader;
public static PlayerStorage storage;
public static Path storagePath;
Expand Down Expand Up @@ -53,6 +56,8 @@ public void onPreInitialize(GeyserPreInitializeEvent event) {
this.disable();
throw new RuntimeException("Failed to load language files!", e);
}

logger.info("Started PickPack " + version);
}

@Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class LanguageManager {
public static String DEFAULT_LOCALE = "en_us";
public static final String EN_US_PROPERTIES = "en_US.properties";
private static final String EN_US_PROPERTIES = "en_US.properties";
public static final Map<String, Properties> LOCALE_PROPERTIES = new HashMap<>();

@SuppressWarnings("resource")
Expand Down Expand Up @@ -82,6 +82,12 @@ public static void init(Path languageFolder) throws IOException {
}

public static String getLocaleString(String locale, String key) {
return LOCALE_PROPERTIES.getOrDefault(locale.toLowerCase(), LOCALE_PROPERTIES.get(DEFAULT_LOCALE)).getProperty(key);
String translation = LOCALE_PROPERTIES.getOrDefault(locale.toLowerCase(), LOCALE_PROPERTIES.get(DEFAULT_LOCALE)).getProperty(key);
if (translation != null) {
return translation;
} else {
PickPack.logger.warning("No translation fallback found for translation key: " + key);
return key;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void loadPacks() {
logger.info("Loaded " + DEFAULT.size() + " default packs!");
logger.info("Loaded " + OPTIONAL.size() + " optional packs!");
} catch (Exception e) {
logger.error("Failed to load packs!", e);
logger.error("Failed to load packs due to: " + (e.getMessage() != null ? e.getMessage() : e));
}
}

Expand All @@ -60,8 +60,10 @@ public HashMap<String, ResourcePack> loadFromFolder(Path path) {
packs.put(uuid, pack);
PACKS_INFO.put(uuid, pack.manifest());
} catch (Exception e) {
logger.error("Failed to load pack " + file.getName(), e);
e.printStackTrace();
logger.error("Failed to load pack at " + file.getName() + " due to: " + (e.getMessage() != null ? e.getMessage() : e));
if (logger.isDebug()) {
e.printStackTrace();
}
}
}
return packs;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ id: pickpack
name: PickPack
main: net.onebeastchris.geyser.extension.pickpack.PickPack
api: 1.0.0
version: 1.2.1
version: 1.2.3
authors: [onebeastchris]

0 comments on commit 6359d0a

Please sign in to comment.