Last active
April 29, 2016 20:33
-
-
Save kinggoesgaming/1bb2fe0e8e7f01502f6ba097aaa3c4ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { | |
tempMap = new HashMap<>(); | |
} | |
if (!tempMap.containsKey(checkNotNull(key, nullTemplate, "key"))) { | |
tempMap.put(key, checkNotNull(config, nullTemplate, "config")); | |
configsMap.put(plugin, tempMap); | |
} else { | |
getFoundationsCore().getLogger().info(format(getSysMessages().get().getNode("configurations", "keyAlreadyRegistered").getString(), key)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment