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