本文整理匯總了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);
}
}