本文整理汇总了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?";
}
示例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);
}
示例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.");
}
}
示例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);
}
示例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.");
}
}
示例6: runExtraData
import org.bukkit.conversations.ConversationContext; //导入方法依赖的package包/类
@Override
public void runExtraData(ConversationContext context, Registration plugin) {
Player ply = (Player) context.getForWhom();
giveItem(ply, plugin);
}
示例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?";
}
示例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?";
}