本文整理汇总了Java中org.bukkit.event.inventory.ClickType.MIDDLE属性的典型用法代码示例。如果您正苦于以下问题:Java ClickType.MIDDLE属性的具体用法?Java ClickType.MIDDLE怎么用?Java ClickType.MIDDLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.event.inventory.ClickType
的用法示例。
在下文中一共展示了ClickType.MIDDLE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onInventoryClick
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ItemStack clicked = event.getCurrentItem();
Inventory inventory = event.getInventory();
if (inventory.getName().equals("Faction Management")) {
if (clicked.getType() == Material.SKULL_ITEM) {
if (event.getClick() == ClickType.LEFT) {
Bukkit.dispatchCommand(player, "f promote " + clicked.getItemMeta().getDisplayName());
event.setCancelled(true);
}
if (event.getClick() == ClickType.MIDDLE){
Bukkit.dispatchCommand(player, "f leader " + clicked.getItemMeta().getDisplayName());
event.setCancelled(true);
}
if (event.getClick() == ClickType.RIGHT) {
Bukkit.dispatchCommand(player, "f demote " + clicked.getItemMeta().getDisplayName());
event.setCancelled(true);
}
}
}
}
示例2: onClick
@Override
public boolean onClick(VPPlayer viewer, ClickType type, MenuLink ml){
if(type == ClickType.RIGHT){
if(VanillaPlusCore.getTitleManager().hasAdminUse(viewer)){
viewer.setTitle(title);
VanillaPlusCore.getMenuManager().refresh(viewer);
return true;
}
}else if(type == ClickType.MIDDLE){
if(VanillaPlusCore.getTitleManager().hasSwitch(viewer)){
if(viewer.hasTitle(title.getID()))
viewer.removeTitle(title);
else
viewer.addTitle(title.getID());
VanillaPlusCore.getMenuManager().refresh(viewer);
return true;
}
}
if(VanillaPlusCore.getTitleManager().hasUse(viewer)){
if(viewer.getTitle() != null && viewer.getTitle().getID()==title.getID()){
viewer.setTitle(null);
}else if(viewer.hasTitle(title.getID())){
viewer.setTitle(title);
}
else
return true;
VanillaPlusCore.getMenuManager().refresh(viewer);
}
return true;
}