@@ -0,0 +1,1885 @@
+package com.github.boformer.answerme.impl;%0A%0Aimport org.apache.commons.collections4.map.LRUMap;%0Aimport org.slf4j.Logger;%0Aimport org.spongepowered.api.Game;%0Aimport org.spongepowered.api.event.state.PreInitializationEvent;%0Aimport org.spongepowered.api.plugin.Plugin;%0Aimport org.spongepowered.api.service.ProviderExistsException;%0Aimport org.spongepowered.api.text.message.Message;%0Aimport org.spongepowered.api.text.message.Messages;%0Aimport org.spongepowered.api.util.command.CommandSource;%0Aimport org.spongepowered.api.util.event.Subscribe;%0A%0Aimport com.github.boformer.answerme.api.Question;%0Aimport com.github.boformer.answerme.api.QuestionService;%0Aimport com.google.common.base.Optional;%0A%0A@Plugin(id = %22AnswerMe%22, name = %22AnswerMe%22, version = %220.1.0%22)%0Apublic class AnswerMePlugin implements QuestionService%0A%7B%0A%09//TODO injection%0A%09private Game game;%0A%09private Logger logger;%0A%09%0A%09private LRUMap%3CCommandSource, Question%3E activeQuestions;%0A%09private Message answerCmdMessage;%0A%09%0A%09@Subscribe%0A%09public void onInit(PreInitializationEvent event)%0A%09%7B%0A%09%09try%0A%09%09%7B%0A%09%09%09game.getServiceManager().setProvider(this, QuestionService.class, this);%0A%09%09%7D%0A%09%09catch (ProviderExistsException e)%0A%09%09%7B%0A%09%09%09logger.warn(%22Question Service was already registered by another plugin :(%22);%0A%09%09%09return;%0A%09%09%7D%0A%09%09%0A%09%09//TODO initialize config, copy defaults%0A%09%09%0A%09%09this.activeQuestions = new LRUMap%3C%3E(100); //TODO configurable cache size %0A%09%09this.answerCmdMessage =  Messages.of(%22Confirm with /yes or cancel with /no%22); //TODO configurable message %0A%09%7D%0A%0A%09@Override%0A%09public void ask(Question question)%0A%09%7B%0A%09%09activeQuestions.put(question.getReceipient(), question);%0A%09%09%0A%09%09question.getReceipient().sendMessage(question.getMessages());%0A%09%09question.getReceipient().sendMessage(answerCmdMessage);%0A%09%7D%0A%0A%09@Override%0A%09public Optional%3CQuestion%3E getActiveQuestion(CommandSource receipient)%0A%09%7B%0A%09%09return Optional.fromNullable(activeQuestions.get(receipient));%0A%09%7D%0A%7D%0A

Add plugin class implementing QuestionService