本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
}
示例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();
}
}
示例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());
}
}
示例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);
}
}
示例9: ConfigOptions
import com.dsh105.echopet.compat.api.util.menu.SelectorLayout; //导入依赖的package包/类
public ConfigOptions(YAMLConfig config) {
super(config);
instance = this;
SelectorLayout.loadLayout();
}