// Path: src/main/java/de/robotricker/transportpipes/ResourcepackService.java
// public class ResourcepackService implements Listener {
// 
//     private static String URL = "https://raw.githubusercontent.com/RoboTricker/Transport-Pipes/master/src/main/resources/wiki/resourcepack.zip";
// 
//     private SentryService sentry;
//     private TransportPipes transportPipes;
//     private PlayerSettingsService playerSettingsService;
// 
//     private ResourcepackMode resourcepackMode;
//     private byte[] cachedHash;
//     private Set<Player> resourcepackPlayers;
//     private Set<Player> loadingResourcepackPlayers;
//     private Set<Player> waitingForAuthmeLogin;
// 
//     @Inject
//     public ResourcepackService(SentryService sentry, TransportPipes transportPipes, PlayerSettingsService playerSettingsService, GeneralConf generalConf) {
//         this.sentry = sentry;
//         this.transportPipes = transportPipes;
//         this.playerSettingsService = playerSettingsService;
//         this.resourcepackMode = generalConf.getResourcepackMode();
//         if (resourcepackMode == ResourcepackMode.DEFAULT) {
//             cachedHash = calcSHA1Hash(URL);
//         }
//         resourcepackPlayers = new HashSet<>();
//         loadingResourcepackPlayers = new HashSet<>();
//         waitingForAuthmeLogin = new HashSet<>();
// 
//         if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
//             Bukkit.getPluginManager().registerEvents(new Listener() {
//                 @EventHandler
//                 public void onAuthMeLogin(fr.xephi.authme.events.LoginEvent e) {
//                     if (waitingForAuthmeLogin.remove(e.getPlayer())) {
//                         loadResourcepackForPlayer(e.getPlayer());
//                     }
//                 }
//             }, transportPipes);
//         }
//     }
// 
//     public byte[] getCachedHash() {
//         return cachedHash;
//     }
// 
//     public Set<Player> getResourcepackPlayers() {
//         return resourcepackPlayers;
//     }
// 
//     public ResourcepackMode getResourcepackMode() {
//         return resourcepackMode;
//     }
// 
//     @EventHandler
//     public void onJoin(PlayerJoinEvent e) {
//         if (getResourcepackMode() == ResourcepackMode.NONE) {
//             transportPipes.changeRenderSystem(e.getPlayer(), VanillaRenderSystem.getDisplayName());
//         } else if (getResourcepackMode() == ResourcepackMode.DEFAULT) {
//             PlayerSettingsConf conf = playerSettingsService.getOrCreateSettingsConf(e.getPlayer());
//             if (conf.getRenderSystemName().equalsIgnoreCase(ModelledRenderSystem.getDisplayName())) {
// 
//                 transportPipes.changeRenderSystem(e.getPlayer(), VanillaRenderSystem.getDisplayName());
// 
//                 if (!Bukkit.getPluginManager().isPluginEnabled("AuthMe") || fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) {
//                     transportPipes.runTaskSync(() -> loadResourcepackForPlayer(e.getPlayer()));
//                 } else if (Bukkit.getPluginManager().isPluginEnabled("AuthMe") && !fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) {
//                     waitingForAuthmeLogin.add(e.getPlayer());
//                 }
//             }
//         }
//     }
// 
//     @EventHandler
//     public void onResourcepackStatus(PlayerResourcePackStatusEvent e) {
//         if (getResourcepackMode() != ResourcepackMode.DEFAULT) {
//             return;
//         }
//         if (e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED || e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
//             LangConf.Key.RESOURCEPACK_FAIL.sendMessage(e.getPlayer());
//             loadingResourcepackPlayers.remove(e.getPlayer());
//         } else if (e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) {
//             resourcepackPlayers.add(e.getPlayer());
//             if (loadingResourcepackPlayers.remove(e.getPlayer())) {
//                 transportPipes.changeRenderSystem(e.getPlayer(), ModelledRenderSystem.getDisplayName());
//             }
//         }
//     }
// 
//     public void loadResourcepackForPlayer(Player p) {
//         if (getResourcepackMode() == ResourcepackMode.DEFAULT) {
//             if (cachedHash == null) {
//                 p.setResourcePack(URL);
//             } else {
//                 p.setResourcePack(URL, cachedHash);
//             }
//             loadingResourcepackPlayers.add(p);
//         }
//     }
// 
//     private byte[] calcSHA1Hash(String resourcepackUrl) {
//         try {
//             URL url = new URL(resourcepackUrl);
//             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//             connection.setRequestMethod("GET");
//             if (connection.getContentLength() <= 0) {
//                 return null;
//             }
//             byte[] resourcePackBytes = new byte[connection.getContentLength()];
//             InputStream in = connection.getInputStream();
// 
//             int b;
//             int i = 0;
//             while ((b = in.read()) != -1) {
//                 resourcePackBytes[i] = (byte) b;
//                 i++;
//             }
// 
//             in.close();
// 
//             if (resourcePackBytes != null) {
//                 MessageDigest md = MessageDigest.getInstance("SHA-1");
//                 return md.digest(resourcePackBytes);
//             }
//         } catch (NoSuchAlgorithmException | IOException e) {
//             e.printStackTrace();
//             sentry.record(e);
//         } catch (Exception e) {
//             sentry.record(e);
//         }
//         return null;
//     }
// 
//     public enum ResourcepackMode {
//         DEFAULT, NONE, SERVER
//     }
// 
// }


import de.robotricker.transportpipes.ResourcepackService;
import org.bukkit.plugin.Plugin;
import java.util.List;
import javax.inject.Inject;

    public boolean isDefaultShowItems() {
        return (boolean) read("default_show_items");
    }

    public int getDefaultRenderDistance() {
        return (int) read("default_render_distance");
    }

    @SuppressWarnings("unchecked")
    public List<String> getDisabledWorlds() {
        return (List<String>) read("disabled_worlds");
    }

    public String getWrenchItem() {
        return (String) read("wrench.item");
    }

    public boolean getWrenchGlowing() {
        return (boolean) read("wrench.glowing");
    }

    public String getLanguage() {
        return (String) read("language");
    }

    public int getShowHiddenDuctsTime() {
        return (int) read("show_hidden_ducts_time");
    }

// Path: src/main/java/de/robotricker/transportpipes/ResourcepackService.java
// public class ResourcepackService implements Listener {
// 
//     private static String URL = "https://raw.githubusercontent.com/RoboTricker/Transport-Pipes/master/src/main/resources/wiki/resourcepack.zip";
// 
//     private SentryService sentry;
//     private TransportPipes transportPipes;
//     private PlayerSettingsService playerSettingsService;
// 
//     private ResourcepackMode resourcepackMode;
//     private byte[] cachedHash;
//     private Set<Player> resourcepackPlayers;
//     private Set<Player> loadingResourcepackPlayers;
//     private Set<Player> waitingForAuthmeLogin;
// 
//     @Inject
//     public ResourcepackService(SentryService sentry, TransportPipes transportPipes, PlayerSettingsService playerSettingsService, GeneralConf generalConf) {
//         this.sentry = sentry;
//         this.transportPipes = transportPipes;
//         this.playerSettingsService = playerSettingsService;
//         this.resourcepackMode = generalConf.getResourcepackMode();
//         if (resourcepackMode == ResourcepackMode.DEFAULT) {
//             cachedHash = calcSHA1Hash(URL);
//         }
//         resourcepackPlayers = new HashSet<>();
//         loadingResourcepackPlayers = new HashSet<>();
//         waitingForAuthmeLogin = new HashSet<>();
// 
//         if (Bukkit.getPluginManager().isPluginEnabled("AuthMe")) {
//             Bukkit.getPluginManager().registerEvents(new Listener() {
//                 @EventHandler
//                 public void onAuthMeLogin(fr.xephi.authme.events.LoginEvent e) {
//                     if (waitingForAuthmeLogin.remove(e.getPlayer())) {
//                         loadResourcepackForPlayer(e.getPlayer());
//                     }
//                 }
//             }, transportPipes);
//         }
//     }
// 
//     public byte[] getCachedHash() {
//         return cachedHash;
//     }
// 
//     public Set<Player> getResourcepackPlayers() {
//         return resourcepackPlayers;
//     }
// 
//     public ResourcepackMode getResourcepackMode() {
//         return resourcepackMode;
//     }
// 
//     @EventHandler
//     public void onJoin(PlayerJoinEvent e) {
//         if (getResourcepackMode() == ResourcepackMode.NONE) {
//             transportPipes.changeRenderSystem(e.getPlayer(), VanillaRenderSystem.getDisplayName());
//         } else if (getResourcepackMode() == ResourcepackMode.DEFAULT) {
//             PlayerSettingsConf conf = playerSettingsService.getOrCreateSettingsConf(e.getPlayer());
//             if (conf.getRenderSystemName().equalsIgnoreCase(ModelledRenderSystem.getDisplayName())) {
// 
//                 transportPipes.changeRenderSystem(e.getPlayer(), VanillaRenderSystem.getDisplayName());
// 
//                 if (!Bukkit.getPluginManager().isPluginEnabled("AuthMe") || fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) {
//                     transportPipes.runTaskSync(() -> loadResourcepackForPlayer(e.getPlayer()));
//                 } else if (Bukkit.getPluginManager().isPluginEnabled("AuthMe") && !fr.xephi.authme.api.v3.AuthMeApi.getInstance().isAuthenticated(e.getPlayer())) {
//                     waitingForAuthmeLogin.add(e.getPlayer());
//                 }
//             }
//         }
//     }
// 
//     @EventHandler
//     public void onResourcepackStatus(PlayerResourcePackStatusEvent e) {
//         if (getResourcepackMode() != ResourcepackMode.DEFAULT) {
//             return;
//         }
//         if (e.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED || e.getStatus() == PlayerResourcePackStatusEvent.Status.FAILED_DOWNLOAD) {
//             LangConf.Key.RESOURCEPACK_FAIL.sendMessage(e.getPlayer());
//             loadingResourcepackPlayers.remove(e.getPlayer());
//         } else if (e.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) {
//             resourcepackPlayers.add(e.getPlayer());
//             if (loadingResourcepackPlayers.remove(e.getPlayer())) {
//                 transportPipes.changeRenderSystem(e.getPlayer(), ModelledRenderSystem.getDisplayName());
//             }
//         }
//     }
// 
//     public void loadResourcepackForPlayer(Player p) {
//         if (getResourcepackMode() == ResourcepackMode.DEFAULT) {
//             if (cachedHash == null) {
//                 p.setResourcePack(URL);
//             } else {
//                 p.setResourcePack(URL, cachedHash);
//             }
//             loadingResourcepackPlayers.add(p);
//         }
//     }
// 
//     private byte[] calcSHA1Hash(String resourcepackUrl) {
//         try {
//             URL url = new URL(resourcepackUrl);
//             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//             connection.setRequestMethod("GET");
//             if (connection.getContentLength() <= 0) {
//                 return null;
//             }
//             byte[] resourcePackBytes = new byte[connection.getContentLength()];
//             InputStream in = connection.getInputStream();
// 
//             int b;
//             int i = 0;
//             while ((b = in.read()) != -1) {
//                 resourcePackBytes[i] = (byte) b;
//                 i++;
//             }
// 
//             in.close();
// 
//             if (resourcePackBytes != null) {
//                 MessageDigest md = MessageDigest.getInstance("SHA-1");
//                 return md.digest(resourcePackBytes);
//             }
//         } catch (NoSuchAlgorithmException | IOException e) {
//             e.printStackTrace();
//             sentry.record(e);
//         } catch (Exception e) {
//             sentry.record(e);
//         }
//         return null;
//     }
// 
//     public enum ResourcepackMode {
//         DEFAULT, NONE, SERVER
//     }
// 
// }


// Path: src/main/java/de/robotricker/transportpipes/config/GeneralConf.java
import de.robotricker.transportpipes.ResourcepackService;
import org.bukkit.plugin.Plugin;
import java.util.List;
import javax.inject.Inject;


    public boolean isDefaultShowItems() {
        return (boolean) read("default_show_items");
    }

    public int getDefaultRenderDistance() {
        return (int) read("default_render_distance");
    }

    @SuppressWarnings("unchecked")
    public List<String> getDisabledWorlds() {
        return (List<String>) read("disabled_worlds");
    }

    public String getWrenchItem() {
        return (String) read("wrench.item");
    }

    public boolean getWrenchGlowing() {
        return (boolean) read("wrench.glowing");
    }

    public String getLanguage() {
        return (String) read("language");
    }

    public int getShowHiddenDuctsTime() {
        return (int) read("show_hidden_ducts_time");
    }

    public ResourcepackService.ResourcepackMode getResourcepackMode() {