org.bukkit.conversations.Prompt Java Examples

The following examples show how to use org.bukkit.conversations.Prompt. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleInputPrompt.java    From HoloAPI with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
    Prompt next = this.function.function(context, input);
    if (next != null) {
        return next;
    }
    return this.successPrompt != null ? this.successPrompt : new SimpleInputSuccessPrompt(this.function.getSuccessMessage(context, input));
}
 
Example #2
Source File: NamePrompt.java    From EchoPet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Prompt acceptInput(ConversationContext conversationContext, String s) {
    if (s.length() > 32) {
        conversationContext.getForWhom().sendRawMessage(EchoPet.getPrefix() + Lang.PET_NAME_TOO_LONG.toString());
        return this;
    }
    conversationContext.setSessionData("name", s);
    return new NameSuccessPrompt(this.pet, this.admin);
}
 
Example #3
Source File: UHPrompts.java    From KTP with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Prompt acceptValidatedInput(ConversationContext context,
		Player input) {
	p.getTeam((String) context.getSessionData("nomTeam")).addPlayer(input);
	context.getForWhom().sendRawMessage(ChatColor.GREEN+input.getName()+ChatColor.DARK_GREEN+" a été ajouté à l'équipe "+((ChatColor)context.getSessionData("color"))+context.getSessionData("nomTeam")+".");
	return Prompt.END_OF_CONVERSATION;
}
 
Example #4
Source File: UHPrompts.java    From KTP with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Prompt acceptValidatedInput(ConversationContext context,
		String input) {
	context.setSessionData("color", StringToChatColor.getChatColorByName(ChatColor.stripColor(input)));
	p.createTeam((String) context.getSessionData("nomTeam"), (ChatColor) context.getSessionData("color"));
	context.getForWhom().sendRawMessage(ChatColor.GRAY+"Team "+((ChatColor)context.getSessionData("color"))+context.getSessionData("nomTeam")+ChatColor.GRAY+" créée.");
	return Prompt.END_OF_CONVERSATION;
}
 
Example #5
Source File: UHPrompts.java    From KTP with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Prompt acceptInput(ConversationContext context, String input) {
	if (input.length() > 16) {
		context.getForWhom().sendRawMessage(ChatColor.RED+"Le nom de la team doit faire 16 caractères maximum.");
		return this;
	}
	context.setSessionData("nomTeam", input);
	return new TeamColorPrompt();
}
 
Example #6
Source File: SingleQuestionPrompt.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String input)
{
	if(input.equalsIgnoreCase("quit") || input.equalsIgnoreCase("stop") || input.equalsIgnoreCase("end"))
		return Prompt.END_OF_CONVERSATION;
	
	if(listener.onAnswer(input))
		return Prompt.END_OF_CONVERSATION;
	else 
		return this;
}
 
Example #7
Source File: InputPrompt.java    From HoloAPI with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Prompt acceptValidatedInput(ConversationContext conversationContext, String s) {
    Object findLoc = conversationContext.getSessionData("findloc");
    if (findLoc != null && ((Boolean) findLoc)) {
        if (s.contains(" ")) {
            String[] split = s.split("\\s");
            if (split.length == 4) {
                if (Bukkit.getWorld(split[0]) != null) {
                    try {
                        conversationContext.setSessionData("location", new Location(Bukkit.getWorld(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]), Integer.parseInt(split[3])));
                        return this.successPrompt;
                    } catch (NumberFormatException e) {
                        conversationContext.setSessionData("fail_int", true);
                    }
                } else {
                    conversationContext.setSessionData("fail_world", true);
                }
            } else {
                conversationContext.setSessionData("fail_format", true);
            }
        } else {
            conversationContext.setSessionData("fail_format", true);
        }
    } else if (s.equalsIgnoreCase("DONE")) {
        conversationContext.setSessionData("lines", this.lines.toArray(new String[this.lines.size()]));
        if (conversationContext.getSessionData("location") == null) {
            if (conversationContext.getForWhom() instanceof Player) {
                conversationContext.setSessionData("location", ((Player) conversationContext.getForWhom()).getLocation());
                return this.successPrompt;
            } else {
                conversationContext.setSessionData("findloc", true);
            }
        } else {
            return this.successPrompt;
        }
    } else {
        this.lines.add(s);
    }
    return new InputPrompt(this.lines, this.successPrompt, s);
}
 
Example #8
Source File: ScriptBuilderPrompt.java    From HoloAPI with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Prompt acceptInput(ConversationContext context, String input) {
    if (input.equalsIgnoreCase("DONE")) {
        LangSetting.send(context.getForWhom(), "}");
        return new ScriptBuilderSuccess(this.lines, this.scriptName);
    }

    this.lines.add(currentlyEditing, input);
    return this;
}
 
Example #9
Source File: NamePrompt.java    From SonarPet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Prompt acceptInput(ConversationContext conversationContext, String s) {
    if (s.length() > 32) {
        conversationContext.getForWhom().sendRawMessage(EchoPet.getPrefix() + Lang.PET_NAME_TOO_LONG.toString());
        return this;
    }
    conversationContext.setSessionData("name", s);
    return new NameSuccessPrompt(this.pet, this.admin);
}
 
Example #10
Source File: ScriptBuilderSuccess.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext context) {
    return END_OF_CONVERSATION;
}
 
Example #11
Source File: InputSuccessPrompt.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext conversationContext) {
    return END_OF_CONVERSATION;
}
 
Example #12
Source File: SimpleInputSuccessPrompt.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext conversationContext) {
    return END_OF_CONVERSATION;
}
 
Example #13
Source File: SimpleInputFunction.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
protected Prompt function(ConversationContext context, String input) {
    this.input = input;
    this.onFunction(context, input);
    return null;
}
 
Example #14
Source File: SimpleInputReturningFunction.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt function(ConversationContext context, String input) {
    this.input = input;
    return this.onFunctionRequest(context, input);
}
 
Example #15
Source File: AnimationBuilderInputSuccessPrompt.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext conversationContext) {
    return END_OF_CONVERSATION;
}
 
Example #16
Source File: BuilderInputSuccessPrompt.java    From HoloAPI with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext conversationContext) {
    return END_OF_CONVERSATION;
}
 
Example #17
Source File: NameSuccessPrompt.java    From SonarPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext context) {
    return Prompt.END_OF_CONVERSATION;
}
 
Example #18
Source File: RegenBlockPrompt.java    From AnnihilationPro with MIT License 4 votes vote down vote up
private Prompt endBlockHelper(ConversationContext context)
{
	context.getForWhom().sendRawMessage(purple+"These regenerating block settings have been saved.");
	context.getForWhom().sendRawMessage(ChatColor.GOLD+"Regenerating Block Helper"+ChatColor.LIGHT_PURPLE+" has been closed.");
	return Prompt.END_OF_CONVERSATION;
}
 
Example #19
Source File: NameSuccessPrompt.java    From EchoPet with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected Prompt getNextPrompt(ConversationContext context) {
    return Prompt.END_OF_CONVERSATION;
}
 
Example #20
Source File: RegenBlockPrompt.java    From AnnihilationPro with MIT License 4 votes vote down vote up
private Prompt saveBlockAndQuit(ConversationContext context)
{
	Game.getGameMap().getRegeneratingBlocks().addRegeneratingBlock(new RegeneratingBlock(this.mat, this.dataVal, this.regenerate, this.cobbleReplace, this.naturalBreak, this.time,
		this.unit, this.xp, this.product, this.amount, this.productData, this.effect));	
	return endBlockHelper(context);
}
 
Example #21
Source File: SimpleInputReturningFunction.java    From HoloAPI with GNU General Public License v3.0 votes vote down vote up
public abstract Prompt onFunctionRequest(ConversationContext context, String input);