當前位置: 首頁>>代碼示例>>Java>>正文


Java SelectorLayout類代碼示例

本文整理匯總了Java中com.dsh105.echopet.compat.api.util.menu.SelectorLayout的典型用法代碼示例。如果您正苦於以下問題:Java SelectorLayout類的具體用法?Java SelectorLayout怎麽用?Java SelectorLayout使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SelectorLayout類屬於com.dsh105.echopet.compat.api.util.menu包,在下文中一共展示了SelectorLayout類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPlayerInteractEntity

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
  public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
      Player p = event.getPlayer();
      Entity e = event.getRightClicked();
int slot = p.getInventory().getHeldItemSlot();
if(slot >= 0 && slot < 9){
	ItemStack itemInHand = p.getInventory().getContents()[slot];
	if(itemInHand != null && itemInHand.getType() != Material.AIR && itemInHand.isSimilar(SelectorLayout.getSelectorItem())){
		new SelectorMenu(p, 0).open(p);
		event.setCancelled(true);
		return;
	}
      }

      if (ReflectionUtil.getEntityHandle(e) instanceof IEntityPet) {
          IPet pet = ((IEntityPet) ReflectionUtil.getEntityHandle(e)).getPet();
          event.setCancelled(true);
          PetInteractEvent iEvent = new PetInteractEvent(pet, p, PetInteractEvent.Action.RIGHT_CLICK, false);
          EchoPet.getPlugin().getServer().getPluginManager().callEvent(iEvent);
          if (!iEvent.isCancelled()) {
              pet.getEntityPet().onInteract(p);
              return;
          }
      }
  }
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:26,代碼來源:PetOwnerListener.java

示例2: onPlayerInteractEntity

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
    Player p = event.getPlayer();
    Entity e = event.getRightClicked();
    if (p.getItemInHand() != null && p.getItemInHand().isSimilar(SelectorLayout.getSelectorItem())) {
        SelectorLayout.getSelectorMenu().showTo(p);
        event.setCancelled(true);
        return;
    }

    if (ReflectionUtil.getEntityHandle(e) instanceof IEntityPet) {
        IPet pet = ((IEntityPet) ReflectionUtil.getEntityHandle(e)).getPet();
        event.setCancelled(true);
        PetInteractEvent iEvent = new PetInteractEvent(pet, p, PetInteractEvent.Action.RIGHT_CLICK, false);
        EchoPet.getPlugin().getServer().getPluginManager().callEvent(iEvent);
        if (!iEvent.isCancelled()) {
            pet.getEntityPet().onInteract(p);
            return;
        }
    }
}
 
開發者ID:TechzoneMC,項目名稱:SonarPet,代碼行數:22,代碼來源:PetOwnerListener.java

示例3: onPrepareItemCraft

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
public void onPrepareItemCraft(PrepareItemCraftEvent event){
	for(ItemStack item : event.getInventory().getMatrix()){
		if(item == null) continue;
		if(ItemUtil.matches(item, SelectorLayout.getSelectorItem())){
			event.getInventory().setResult(new ItemStack(Material.AIR));
			break;
		}
	}
}
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:11,代碼來源:PetOwnerListener.java

示例4: onCraftItem

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
public void onCraftItem(CraftItemEvent event){// kinda not needed.
	for(ItemStack item : event.getInventory().getMatrix()){
		if(item == null) continue;
		if(ItemUtil.matches(item, SelectorLayout.getSelectorItem())){
			event.setResult(Event.Result.DENY);
			event.setCancelled(true);
			break;
		}
	}
}
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:12,代碼來源:PetOwnerListener.java

示例5: onPlayerInteract

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
 public void onPlayerInteract(PlayerInteractEvent event) {
     Player p = event.getPlayer();
     ItemStack itemStack = event.getItem();
     if (itemStack != null && itemStack.isSimilar(SelectorLayout.getSelectorItem())) {
new SelectorMenu(p, 0).open(p);
         event.setCancelled(true);
     }
 }
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:10,代碼來源:PetOwnerListener.java

示例6: onDropItem

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDropItem(PlayerDropItemEvent event) {
    if (event.getItemDrop().getItemStack().isSimilar(SelectorLayout.getSelectorItem()) && !(ConfigOptions.instance.getConfig().getBoolean("petSelector.allowDrop", true))) {
        event.setCancelled(true);
        event.getPlayer().updateInventory();
    }
}
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:8,代碼來源:PetOwnerListener.java

示例7: openPetSelector

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
/**
 * Opens the Pet Selector GUI Menu
 *
 * @param player      {@link org.bukkit.entity.Player} to view the Menu
 * @param sendMessage defines if the plugin sends a message to the target {@link org.bukkit.entity.Player}
 */
public void openPetSelector(Player player, boolean sendMessage) {
    SelectorLayout.getSelectorMenu().showTo(player);
    if (false) {
        Lang.sendTo(player, Lang.OPEN_SELECTOR.toString());
    }
}
 
開發者ID:TechzoneMC,項目名稱:SonarPet,代碼行數:13,代碼來源:EchoPetAPI.java

示例8: onPlayerInteract

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    Player p = event.getPlayer();
    ItemStack itemStack = event.getItem();
    if (itemStack != null && itemStack.isSimilar(SelectorLayout.getSelectorItem())) {
        SelectorLayout.getSelectorMenu().showTo(p);
        event.setCancelled(true);
    }
}
 
開發者ID:TechzoneMC,項目名稱:SonarPet,代碼行數:10,代碼來源:PetOwnerListener.java

示例9: ConfigOptions

import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //導入依賴的package包/類
public ConfigOptions(YAMLConfig config) {
    super(config);
    instance = this;
    SelectorLayout.loadLayout();
}
 
開發者ID:Borlea,項目名稱:EchoPet,代碼行數:6,代碼來源:ConfigOptions.java


注:本文中的com.dsh105.echopet.compat.api.util.menu.SelectorLayout類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。