本文整理汇总了Java中org.bukkit.conversations.Prompt类的典型用法代码示例。如果您正苦于以下问题:Java Prompt类的具体用法?Java Prompt怎么用?Java Prompt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Prompt类属于org.bukkit.conversations包,在下文中一共展示了Prompt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext arg0, String arg1) {
if (arg1.equals("back")) {
return new ShopCategoryChooser(plugin);
}
Item i = itemCache.get(Integer.parseInt(arg1));
arg0.setSessionData("item", itemCache.get(Integer.parseInt(arg1))
.getItemType());
if (inventory.contains(i.getItemType())) {
arg0.setSessionData("free", true);
} else {
arg0.setSessionData("free", false);
}
return new ItemInfoPrompt(plugin);
}
示例2: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext arg0, Number arg1) {
if (arg1.intValue() < 0) {
return new SilverTransferItem(plugin);
}
if (arg1.intValue() > sply.getCurrency()) {
return new SilverTransferItem(plugin);
}
Player dply = (Player) arg0.getSessionData("player");
SPlayer dsply = plugin.players.get(dply.getName());
dsply.sendMessage(sply.getPlayer().getDisplayName() + " (" + sply.getPlayer().getName() + ") just sent you " + arg1.intValue() + " silver.");
dsply.addCurrency(arg1.intValue(), false);
sply.delCurrency(arg1.intValue());
arg0.getForWhom().sendRawMessage(
ChatColor.AQUA + "Inventory: Transferred "
+ NumberFormat.getInstance().format(arg1.intValue())
+ " silver to " + dply.getName() + ".");
return Prompt.END_OF_CONVERSATION;
}
示例3: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext context,
String input) {
int option = Integer.parseInt(input);
Player ply = (Player) context.getForWhom();
SPlayer sply = plugin.players.get(ply.getName());
if (option == 3) {
return new AwardList(plugin);
} else if (option == 2) {
return new SilverTransferPlayerPrompt(plugin);
} else if (option == 1) {
if (sply.getInventoryStore().getInventory().size() == 0) {
context.getForWhom().sendRawMessage(
ChatColor.AQUA + "Inventory: " + ChatColor.RED
+ "You have no items. Buy some to fix this!");
return new InventoryStart(plugin);
}
return new ItemList(plugin);
}
return new InventoryStart(plugin);
}
示例4: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext context, String message) {
if ("menu".equalsIgnoreCase(message)) {
// Return to main menu
return new StartAdministration();
} else {
// Save the chosen structure to the data
context.setSessionData("chosen_structure", getStructureChoices(context).get(Integer.parseInt(message)));
// Return next menu depending on the chosen structure
if (((DemigodsStructureType) context.getSessionData("chosen_structure")).getDesigns().size() > 1) {
return new Design();
} else {
return new Selection();
}
}
}
示例5: acceptInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
public Prompt acceptInput(ConversationContext context, String input)
{
PlayerData data = plugin.getPlayerDataCache().getData(player);
if (data.getInvited().contains(input.toLowerCase()))
{
player.sendRawMessage(FormatUtil.format("&cError: &4" + plugin.getMessage("already_invited")));
return Prompt.END_OF_CONVERSATION;
}
OfflinePlayer invite = Util.matchOfflinePlayer(input);
if (invite == null || ! invite.hasPlayedBefore())
{
data.getInvited().add(input.toLowerCase());
player.sendRawMessage(FormatUtil.format(plugin.getPrefix() + plugin.getMessage("invite_confirmed"), input));
}
else
{
player.sendRawMessage(FormatUtil.format("&cError: &4" + plugin.getMessage("has_played_before")));
}
return Prompt.END_OF_CONVERSATION;
}
示例6: acceptInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@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);
}
示例7: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@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;
}
示例8: acceptInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
public Prompt acceptInput(final ConversationContext arg0, String arg1) {
if ( arg1.startsWith("/") ) arg1 = arg1.substring(1);
if ( arg1.equals("exit") || arg1.equals("quit") || arg1.equals("stop") ) return null;
Parameter r = null;
buffer.append(arg1);
buffer.append("\n");
String test = buffer.toString();
if ( TCLUtils.isCompleteStatement(test) ) {
buffer = new StringBuilder();
ThreadManager.instance().submitWork(new BranchEvaluationResult(new StringParameter(test), ctx, new EvaluationResult.EvalCallback() {
public EvaluationResult result(EvaluationResult e) {
if ( e.getCode() == Code.ERROR ) {
arg0.getForWhom().sendRawMessage(ChatColor.RED + "Error: " + e.getValue().asString());
}
if ( e.getValue() != null ) ctx.put("ans", e.getValue());
else ctx.put("ans", Parameter.from(""));
return EvaluationResult.OK;
}
}));
}
return this;
}
示例9: acceptInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@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;
}
示例10: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@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);
}
示例11: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@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));
}
示例12: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext context,
boolean input) {
if (input) {
final SPlayer ply = plugin.players.get(((Player) context.getForWhom()).getName());
final Item i = (Item) context.getSessionData("itemobj");
final boolean clearChatColorCopy = clearChatColor;
final boolean clearChatTitleCopy = clearChatTitle;
plugin.getServer().getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
ply.addCurrency(refund, false);
ply.saveCurrency();
ply.getInventoryStore().delItem(i);
if (clearChatColorCopy) {
ply.setChatColor("");
}
if (clearChatTitleCopy) {
ply.setChatPrefix("");
}
plugin.conn.cacheChatFormat(ply);
ply.saveAccount();
}
});
}
return new ItemList(plugin);
}
示例13: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext arg0, String arg1) {
if (arg1.toLowerCase().equals("sunny")) {
arg0.setSessionData("storm", false);
} else {
arg0.setSessionData("storm", true);
}
return new FinalShopConfirmation(plugin);
}
示例14: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext context,
Player input) {
if (input.getWorld().getName().contains("stock")) {
context.getForWhom()
.sendRawMessage(
ChatColor.RED
+ "Player is in Pure, and can't be selected at this time.");
return new PlayerSelector(plugin);
}
context.setSessionData("player", input);
return new FinalShopConfirmation(plugin);
}
示例15: acceptValidatedInput
import org.bukkit.conversations.Prompt; //导入依赖的package包/类
@Override
protected Prompt acceptValidatedInput(ConversationContext arg0, Number arg1) {
double discount = (Double) arg0.getSessionData("discount");
if (arg1.intValue() > 64 || arg1.intValue() < 1) {
return new MCItemAmountSelector(plugin);
}
if (arg1.intValue()
* (item.getItemCost() - (item.getItemCost() * discount)) > sply.getCurrency()) {
return new MCItemAmountSelector(plugin);
}
arg0.setSessionData("count", arg1.intValue());
return new FinalShopConfirmation(plugin);
}