FMLCommonHandler.instance().bus().register(new CCCEventHandler());
}
}
private void notificationCheck() {
final ConfigTag tag = config.getTag("checkNotifications").setComment("The most recent notification number recieved. -1 to disable");
final int notify = tag.getIntValue(0);
if(notify < 0)
return;
CCUpdateChecker.updateCheck(
"http://www.chickenbones.net/Files/notification/general.php",
new Function<String, Void>()
{
@Override
public Void apply(String ret) {
Matcher m = Pattern.compile("Ret \\((\\d+)\\): (.+)").matcher(ret);
if (!m.matches()) {
CodeChickenCorePlugin.logger.error("Failed to check notifications: " + ret);
return null;
}
int index = Integer.parseInt(m.group(1));
if(index > notify) {
tag.setIntValue(index);
CCUpdateChecker.addUpdateMessage(m.group(2));
}
return null;
}
});