本文整理汇总了Java中org.bukkit.inventory.Inventory.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Inventory.getName方法的具体用法?Java Inventory.getName怎么用?Java Inventory.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.inventory.Inventory
的用法示例。
在下文中一共展示了Inventory.getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleInventory
import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
@Nonnull
private static String handleInventory(Inventory inventory) {
final String basicInfo = "name=" + inventory.getName() + ", title=" + inventory.getTitle()
+ ", size=" + inventory.getSize() + "\n";
return basicInfo + handleArray(inventory.getContents());
}
示例2: onCheckSetPlayerInventory
import org.bukkit.inventory.Inventory; //导入方法依赖的package包/类
@EventHandler
public void onCheckSetPlayerInventory(InventoryClickEvent event){
Inventory inventory = event.getInventory();
String inventoryName = inventory.getName();
ItemStack item = event.getCurrentItem();
if(inventoryName.contains(Message.getMsg("setPlayerGui.guiName").replace("{0}",""))){
Player admin = (Player) event.getView().getPlayer();
if(item != null&&!item.getType().equals(Material.AIR)){
String player = inventory.getItem(4).getItemMeta().getDisplayName().replace("§4§l", "");
if(event.getRawSlot() <=26){
//当点到PK点数时
if(item.getItemMeta().getDisplayName().equals(Message.getMsg("setPlayerGui.wanted.Name"))){
if(JailMap.containsKey(admin)){
JailMap.remove(admin);
}
PKMap.put(admin, player);
admin.sendMessage(Message.getMsg("admin.waitForInputMessage"));
admin.closeInventory();
}
//当点到监狱时间时
if(item.getItemMeta().getDisplayName().equals(Message.getMsg("setPlayerGui.jail.Name"))){
if(PKMap.containsKey(admin)){
PKMap.remove(admin);
}
JailMap.put(admin, player);
admin.sendMessage(Message.getMsg("admin.waitForInputMessage"));
admin.closeInventory();
}
//当点到通缉目标时
if(item.getItemMeta().getDisplayName().equals(Message.getMsg("setPlayerGui.asWanted.Name"))){
YamlConfiguration PlayerData = PVPAsWantedManager.onLoadData(player);
if(!PlayerData.getString("asWanted.target").equals("N/A")){
PlayerData.set("asWanted.target", String.valueOf("N/A"));
PVPAsWantedManager.onSaveData(player, PlayerData);
openSetPlayerGui(admin,player);
}else{
openSetPlayerGui(admin,player);
}
}
//当点到退出菜单时
if(item.getItemMeta().getDisplayName().equals(Message.getMsg("asWantedGui.quit"))){
admin.closeInventory();
}
}
}
event.setCancelled(true);
}
}