当前位置: 首页>>代码示例>>Java>>正文


Java ConversationContext.getForWhom方法代码示例

本文整理汇总了Java中org.bukkit.conversations.ConversationContext.getForWhom方法的典型用法代码示例。如果您正苦于以下问题:Java ConversationContext.getForWhom方法的具体用法?Java ConversationContext.getForWhom怎么用?Java ConversationContext.getForWhom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bukkit.conversations.ConversationContext的用法示例。


在下文中一共展示了ConversationContext.getForWhom方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPromptText

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public String getPromptText(ConversationContext context) {
	Player ply = (Player) context.getForWhom();
	SPlayer sply = plugin.players.get(ply.getName());
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: "
					+ "Welcome to your ShankShock inventory!");
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + "To exit at any time, type: "
					+ ChatColor.RED + "LEAVENOW!");
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + ChatColor.GRAY + "Silver: "
					+ NumberFormat.getInstance().format(sply.getCurrency()));
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + "Options: ");
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + ChatColor.GOLD + "1. "
					+ ChatColor.AQUA + "View items");
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + ChatColor.GOLD + "2. "
					+ ChatColor.AQUA + "Transfer Silver");
	context.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + ChatColor.GOLD + "3. "
					+ ChatColor.AQUA + "View awards");
	return "Which option number?";
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:27,代码来源:InventoryStart.java

示例2: acceptValidatedInput

import org.bukkit.conversations.ConversationContext; //导入方法依赖的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);
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:23,代码来源:InventoryStart.java

示例3: runExtraData

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public void runExtraData(ConversationContext context, Registration plugin) {
	Player ply = (Player) context.getForWhom();
	int amount = (Integer) context.getSessionData("count");
	item.setAmount(amount);
	HashMap<Integer, ItemStack> extraItems = ply.getInventory().addItem(item);

	int returnAmount = 0;
	for (ItemStack s : extraItems.values()) {
		returnAmount += s.getAmount();
	}

	if (returnAmount != 0) {
		int returnSilver = (int) (returnAmount * (this.getItemCost() - (this.getItemCost() * (Double) context.getSessionData("discount"))));
		SPlayer sply = plugin.players.get(ply.getName());
		sply.setCurrency(sply.getCurrency() + returnSilver);
		context.getForWhom().sendRawMessage(ChatColor.AQUA + "Shop: Some items you ordered wouldn't fit in your inventory. They have been refunded.");
	}
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:20,代码来源:MinecraftItem.java

示例4: acceptValidatedInput

import org.bukkit.conversations.ConversationContext; //导入方法依赖的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);
}
 
开发者ID:DSH105,项目名称:HoloAPI,代码行数:41,代码来源:InputPrompt.java

示例5: runExtraData

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public void runExtraData(ConversationContext context, Registration plugin) {
	Player ply = (Player) context.getForWhom();
	HashMap<Integer, ItemStack> extraItems = ply.getInventory().addItem(item);

	int returnAmount = 0;
	for (ItemStack s : extraItems.values()) {
		returnAmount++;
		ply.getWorld().dropItem(ply.getLocation(), s);
	}

	if (returnAmount != 0) {
		context.getForWhom().sendRawMessage(ChatColor.AQUA + "Shop: Some items you ordered wouldn't fit in your inventory. They have been dropped on the floor.");
	}
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:16,代码来源:MinecraftKitItem.java

示例6: runExtraData

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public void runExtraData(ConversationContext context, Registration plugin) {
	Player ply = (Player) context.getForWhom();
	
	giveItem(ply, plugin);
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:7,代码来源:RuleBookItem.java

示例7: getPromptText

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public String getPromptText(ConversationContext context) {
	ply = (Player) context.getForWhom();
	sply = plugin.players.get(ply.getName());
	return "How much Silver would you like to send?";
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:7,代码来源:SilverTransferItem.java

示例8: getPromptText

import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public String getPromptText(ConversationContext arg0) {
	award = (Award) arg0.getSessionData("award");
	arg0.getForWhom().sendRawMessage(
			ChatColor.AQUA + "Inventory: " + ChatColor.GOLD + "Award: "
					+ ChatColor.AQUA + award.getName());
	Player ply = (Player) arg0.getForWhom();
	SPlayer sply = plugin.players.get(ply.getName());
	if (award instanceof CounterAward) {
		CounterAward counterAward = (CounterAward) award;
		ArrayList<RawAward> rawAwards = sply.getRawAwardStore()
				.getRawAwards();
		RawAward temp = null;
		for (RawAward r : rawAwards) {
			if (r.getType() == award.getType()) {
				temp = r;
			}
		}

		if (temp == null) {
			arg0.getForWhom().sendRawMessage(
					ChatColor.AQUA + "Inventory: " + ChatColor.GOLD
							+ "Award Description: " + ChatColor.AQUA
							+ award.getDescription());
			arg0.getForWhom().sendRawMessage(
					ChatColor.AQUA + "Inventory: " + ChatColor.GOLD
							+ "Award Status: " + ChatColor.AQUA
							+ counterAward.getMaxMetaData() + "/"
							+ counterAward.getMaxMetaData());
		} else {
			arg0.getForWhom().sendRawMessage(
					ChatColor.AQUA + "Inventory: " + ChatColor.GOLD
							+ "Award Description: " + ChatColor.AQUA
							+ award.getDescription());
			arg0.getForWhom().sendRawMessage(
					ChatColor.AQUA + "Inventory: " + ChatColor.GOLD
							+ "Award Status: " + ChatColor.AQUA
							+ temp.getMetaData() + "/"
							+ counterAward.getMaxMetaData());
		}
	} else {
		arg0.getForWhom().sendRawMessage(
				ChatColor.AQUA + "Inventory: " + ChatColor.GOLD
						+ "Award Description: " + ChatColor.AQUA
						+ award.getDescription());
	}
	return "Return back to the award list?";
}
 
开发者ID:hakusaro,项目名称:ShankShock-Core,代码行数:49,代码来源:AwardInfo.java


注:本文中的org.bukkit.conversations.ConversationContext.getForWhom方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。