use of fr.neatmonster.nocheatplus.actions.ActionFactoryFactory in project NoCheatPlus by NoCheatPlus.
the class NoCheatPlus method getActionFactoryFactory.
@Override
public ActionFactoryFactory getActionFactoryFactory() {
ActionFactoryFactory factory = getGenericInstance(ActionFactoryFactory.class);
if (factory == null) {
setActionFactoryFactory(null);
factory = getGenericInstance(ActionFactoryFactory.class);
}
return factory;
}
use of fr.neatmonster.nocheatplus.actions.ActionFactoryFactory in project NoCheatPlus by NoCheatPlus.
the class NoCheatPlus method setActionFactoryFactory.
@Override
public ActionFactoryFactory setActionFactoryFactory(ActionFactoryFactory actionFactoryFactory) {
if (actionFactoryFactory == null) {
actionFactoryFactory = new ActionFactoryFactory() {
@Override
public final ActionFactory newActionFactory(final Map<String, Object> library) {
return new ActionFactory(library);
}
};
}
final ActionFactoryFactory previous = registerGenericInstance(ActionFactoryFactory.class, actionFactoryFactory);
// Use lazy resetting.
final IWorldDataManager worldMan = NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager();
final Iterator<Entry<String, IWorldData>> it = worldMan.getWorldDataIterator();
while (it.hasNext()) {
final ConfigFile config = it.next().getValue().getRawConfiguration();
config.setActionFactory(actionFactoryFactory);
}
// (Removing cached configurations and update are to be called externally.)
return previous;
}
Aggregations