Added debug logging for language download
This commit is contained in:
1 parent
98b2b1982e
commit
8cc3219a33
4 files changed
+16
No files matched your search
@@ -90,6 +90,8 @@ public class ImageFrame extends JavaPlugin {
|
||||
public static boolean viaHook = false;
|
||||
public static boolean viaDisableSmoothAnimationForLegacyPlayers = false;
|
||||
|
||||
public static boolean debugLogging;
|
||||
|
||||
public static boolean updaterEnabled;
|
||||
public static ScheduledTask updaterTask = null;
|
||||
|
||||
@@ -384,6 +386,8 @@ public class ImageFrame extends JavaPlugin {
|
||||
storageType = KeyUtils.imageFrameKey(config.getConfiguration().getString("Storage.Type"));
|
||||
storageOptions = config.getConfiguration().getConfigurationSection("Storage.Options").getValues(true).entrySet().stream().collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue().toString()));
|
||||
|
||||
debugLogging = config.getConfiguration().getBoolean("DebugLogging");
|
||||
|
||||
if (updaterTask != null) {
|
||||
updaterTask.cancel();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
package com.loohp.imageframe.debug;
|
||||
|
||||
import com.loohp.imageframe.ImageFrame;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
@@ -28,6 +29,12 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class Debug implements Listener {
|
||||
|
||||
public static void debug(String message) {
|
||||
if (ImageFrame.debugLogging) {
|
||||
Bukkit.getConsoleSender().sendMessage("[LOTTERYSIX|DEBUG] " + message);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoinPluginActive(PlayerJoinEvent event) {
|
||||
if (event.getPlayer().getName().equals("LOOHP") || event.getPlayer().getName().equals("AppLEshakE")) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.loohp.imageframe.ImageFrame;
|
||||
import com.loohp.imageframe.debug.Debug;
|
||||
import com.loohp.imageframe.utils.HTTPRequestUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.TranslatableComponent;
|
||||
@@ -92,6 +93,7 @@ public class LanguageManager {
|
||||
|
||||
JsonObject json;
|
||||
try {
|
||||
Debug.debug("Downloading language meta...");
|
||||
json = HTTPRequestUtils.getJsonResponse(LANGUAGE_META_URL);
|
||||
} catch (Exception e) {
|
||||
throw new IOException("Unable to fetch language meta from \"api.loohpjames.com\". This could be an internet issue or \"api.loohpjames.com\" is down. If the plugin functions correctly after this, this error can be ignored.", e);
|
||||
@@ -104,6 +106,7 @@ public class LanguageManager {
|
||||
|
||||
String existingHash = languageHashes.has(language) ? languageHashes.get(language).getAsString() : null;
|
||||
if (!hash.equalsIgnoreCase(existingHash)) {
|
||||
Debug.debug("Downloading language " + language + "...");
|
||||
try (
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(HTTPRequestUtils.getInputStream(url), StandardCharsets.UTF_8));
|
||||
PrintWriter writer = new PrintWriter(new OutputStreamWriter(Files.newOutputStream(new File(languageFolder, language + ".json").toPath()), StandardCharsets.UTF_8));
|
||||
|
||||
@@ -119,5 +119,7 @@ Hooks:
|
||||
#Enable this if your players below 1.13 is having network issues
|
||||
DisableSmoothAnimationForLegacyPlayers: false
|
||||
|
||||
DebugLogging: false
|
||||
|
||||
#Enable update notifications for admins
|
||||
Updater: true
|
||||
Reference in new issue
Block a user