当前位置: 首页>>代码示例>>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;未经允许,请勿转载。