Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ItsTautvydas

Members
  • Joined

  • Last visited

Everything posted by ItsTautvydas

  1. Hello, I'm trying to write configuration file, so I search around this site and found config handler full class, and not gonna lie - I took it, I was too lazy to make it myself, I edit a bit and added some functions. Problem is when I use upper case letters in category, it duplicates (code below). The uppercase category "Mod" get none of keys and values, lower case gets it. Also when using lower case, no duplicates, everythink is fine, but all lower cased categories doesn't look great, because I have mod config button enabled, so yeah.. # Configuration file Mod { settings { } } mod { B:"Mod Enabled"=true settings { S:"Custom Toggle Command"=ar:toggle B:"Toggle Command"=true } } How I use config handler @EventHandler public void onInitialization(FMLInitializationEvent event) { if (ConfigHandler.hasCategory("Mod") == false) { ConfigHandler.writeConfig("Mod", "Mod Enabled", true); } if (ConfigHandler.hasCategory("Mod.settings") == false) { ConfigHandler.writeConfig("Mod.settings", "SEOL", 0); ConfigHandler.writeConfig("Mod.settings", "Toggle Command", true); ConfigHandler.writeConfig("Mod.settings", "Custom Toggle Command", "ar:toggle"); } } ConfigHandler class, not full, writeConfig() only, and also init() public static void init() { config = new Configuration(new File(file)); try { config.load(); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, String value) { config = new Configuration(new File(file)); try { config.load(); String set = config.get(category, key, value).getString(); config.getCategory(category).get(key).set(value); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, int value) { config = new Configuration(new File(file)); try { config.load(); int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, boolean value) { config = new Configuration(new File(file)); try { config.load(); boolean set = config.get(category, key, value).getBoolean(); config.getCategory(category).get(key).set(value); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, long value) { config = new Configuration(new File(file)); try { config.load(); long set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(value); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, double value) { config = new Configuration(new File(file)); try { config.load(); double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(value); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, short value) { config = new Configuration(new File(file)); try { config.load(); int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(Integer.valueOf(value)); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, byte value) { config = new Configuration(new File(file)); try { config.load(); int set = config.get(category, key, value).getInt(); config.getCategory(category).get(key).set(Integer.valueOf(value)); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } public static void writeConfig(String category, String key, float value) { config = new Configuration(new File(file)); try { config.load(); double set = config.get(category, key, value).getDouble(); config.getCategory(category).get(key).set(Double.valueOf(value)); } catch (Exception e) { System.out.println("Cannot load configuration file!"); } finally { config.save(); } } }

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.