Skip to content

Instantly share code, notes, and snippets.

View kinggoesgaming's full-sized avatar
👀
404 Not Found

Hunar Roop Kahlon kinggoesgaming

👀
404 Not Found
View GitHub Profile
[17:52:55] [Server thread/INFO] [STDERR]: [com.kinggoesgaming.foundations.core.FoundationsCore:onInitialization:99]: java.nio.file.NoSuchFileException: config/com.kinggoesgaming.foundations.core/global.conf
[17:52:55] [Server thread/INFO] [STDERR]: [com.kinggoesgaming.foundations.core.FoundationsCore:onInitialization:99]: at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
[17:52:55] [Server thread/INFO] [STDERR]: [com.kinggoesgaming.foundations.core.FoundationsCore:onInitialization:99]: at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[17:52:55] [Server thread/INFO] [STDERR]: [com.kinggoesgaming.foundations.core.FoundationsCore:onInitialization:99]: at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[17:52:55] [Server thread/INFO] [STDERR]: [com.kinggoesgaming.foundations.core.FoundationsCore:onInitialization:99]: at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
[17:52:55] [Server thread/INFO] [STDERR]
/*
* This file is part of FoundationsCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 - 2016 Hunar Roop (KingGoesGaming) Kahlon <http://www.kinggoesgaming.com>
* Copyright (c) Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/*
* This file is part of FoundationsCore, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 - 2016 Hunar Roop (KingGoesGaming) Kahlon <http://www.kinggoesgaming.com>
* Copyright (c) Contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
public final class ConfigurationUtil {
private ConfigurationUtil() {}
private static ConfigurationService configurationService = Sponge.getServiceManager().provide(ConfigurationService.class).get();
private static List<Configuration> configurationList = new ArrayList<>();
public static void registerConfigs() {
registerConfig("global", new GlobalConfig());
List Values
~~~~~~~~~~~
Unlike the basic values, getting values from lists is slightly more involved, as multiple values are involved.
The main getters for lists are ``getList(Function<Object, T>):List<T>``, ``getList(Function<Object, T>, List<T>):List<T>``,
``getList(TypeToken<T>):List<T>``, ``getList(TypeToken<T>, List<T>):List<T>``.
For the purpose of teaching the following sample will be used be used:
.. code-block:: json

List Values

Unlike the basic values, getting values from lists is slightly more involved, as multiple values are involved. The main getters for lists are getList(Function<Object, T>):List<T>, getList(Function<Object, T>, List<T>):List<T>, getList(TypeToken<T>):List<T>, getList(TypeToken<T>, List<T>):List<T>.

For the purpose of teaching the following sample will be used be used:

/usr/lib/jvm/java-8-openjdk/bin/java -Didea.launcher.port=7532 -Didea.launcher.bin.path=/usr/share/intellijidea-ce/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar:/home/hunar/Foundations/FoundationsAPI/build/classes/main:/home/hunar/.gradle/caches/SpongeStart/start:/usr/
private Map<Object, Map<String, C config>> configsMap = new HashMap<>();
public void register(@Nonnull Object plugin, @Nonnull String key, @Nonnull C config) {
getPluginManager().fromInstance(checkNotNull(plugin, nullTemplate, "plugin")).ifPresent(container -> {
final String id = container.getId();
Map<String, C> tempMap;
if (configsMap.containsKey(id)) {
tempMap = configsMap.get(id);
} else {

Foundations Module System

  • ModuleState:enum
    • PRE_PROVIDE: The initial state the system starts with. No module is allowed to be registered.
    • PROVIDE: The ModuleService has been provided. No module is allowed to be registered.
    • SYS_REGISTER: Foundations Core can add its needed modules. No external modules are allowed.

Flards Poetry

Twitter Follow | GitHub license | Dependency

Master: Master branch | Bleeding: Bleeding branch