当前位置: 首页>>代码示例>>Java>>正文


Java SlotType.OUTSIDE属性代码示例

本文整理汇总了Java中org.bukkit.event.inventory.InventoryType.SlotType.OUTSIDE属性的典型用法代码示例。如果您正苦于以下问题:Java SlotType.OUTSIDE属性的具体用法?Java SlotType.OUTSIDE怎么用?Java SlotType.OUTSIDE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.event.inventory.InventoryType.SlotType的用法示例。


在下文中一共展示了SlotType.OUTSIDE属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentItem

/**
 * Gets the ItemStack currently in the clicked slot.
 *
 * @return the item in the clicked
 */
public ItemStack getCurrentItem() {
    if (slot_type == SlotType.OUTSIDE) {
        return current;
    }
    return getView().getItem(rawSlot);
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:11,代码来源:InventoryClickEvent.java

示例2: setCurrentItem

/**
 * Sets the ItemStack currently in the clicked slot.
 *
 * @param stack the item to be placed in the current slot
 */
public void setCurrentItem(ItemStack stack) {
    if (slot_type == SlotType.OUTSIDE) {
        current = stack;
    } else {
        getView().setItem(rawSlot, stack);
    }
}
 
开发者ID:CyberdyneCC,项目名称:Thermos-Bukkit,代码行数:12,代码来源:InventoryClickEvent.java

示例3: getCurrentItem

/**
 * Gets the ItemStack currently in the clicked slot. Returns air for empty
 * slots and null for clicking outside the inventory.
 *
 * @return the item in the clicked slot
 */
public ItemStack getCurrentItem() {
    if (slot_type == SlotType.OUTSIDE) {
        return current;
    }
    return getView().getItem(rawSlot);
}
 
开发者ID:Bukkit,项目名称:Bukkit-JavaDoc,代码行数:12,代码来源:InventoryClickEvent.java

示例4: getSlotType

public static SlotType getSlotType(InventoryView inventory, int slot) {
    SlotType type = SlotType.CONTAINER;
    if (inventory == null) return type; // Cauldron - modded inventories with no Bukkit wrapper
    if (slot >= 0 && slot < inventory.getTopInventory().getSize()) {
        switch(inventory.getType()) {
        case FURNACE:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else if(slot == 1) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BREWING:
            if (slot == 3) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case ENCHANTING:
            type = SlotType.CRAFTING;
            break;
        case WORKBENCH:
        case CRAFTING:
            if (slot == 0) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case MERCHANT:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BEACON:
            type = SlotType.CRAFTING;
            break;
        case ANVIL:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        default:
            // Nothing to do, it's a CONTAINER slot
        }
    } else {
        if (slot == -999) {
            type = SlotType.OUTSIDE;
        } else if (inventory.getType() == InventoryType.CRAFTING) {
            if (slot < 9) {
            type = SlotType.ARMOR;
            } else if (slot > 35) {
                type = SlotType.QUICKBAR;
            }
        } else if (slot >= (inventory.countSlots() - 9)) {
            type = SlotType.QUICKBAR;
        }
    }
    return type;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:67,代码来源:CraftInventoryView.java

示例5: getSlotType

public static SlotType getSlotType(InventoryView inventory, int slot) {
    SlotType type = SlotType.CONTAINER;
    if (slot >= 0 && slot < inventory.getTopInventory().getSize()) {
        switch(inventory.getType()) {
        case FURNACE:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else if(slot == 1) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BREWING:
            if (slot == 3) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case ENCHANTING:
            type = SlotType.CRAFTING;
            break;
        case WORKBENCH:
        case CRAFTING:
            if (slot == 0) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case MERCHANT:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BEACON:
            type = SlotType.CRAFTING;
            break;
        case ANVIL:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        default:
            // Nothing to do, it's a CONTAINER slot
        }
    } else {
        if (slot == -999) {
            type = SlotType.OUTSIDE;
        } else if (inventory.getType() == InventoryType.CRAFTING) {
            if (slot < 9) {
                type = SlotType.ARMOR;
            } else if (slot > 35) {
                type = SlotType.QUICKBAR;
            }
        } else if (slot >= (inventory.countSlots() - 9)) {
            type = SlotType.QUICKBAR;
        }
    }
    return type;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:66,代码来源:CraftInventoryView.java

示例6: onInventoryClick

@EventHandler
   public void onInventoryClick(InventoryClickEvent event) {
// TODO : this needs optimization
Player player = (Player) event.getWhoClicked(); // The player that
						// clicked the item
ItemStack clicked = event.getCurrentItem(); // The item that was clicked
Inventory inventory = event.getInventory(); // The inventory that was
					    // clicked in
int slot = event.getRawSlot();
// Challenges
if (inventory.getName().equals(plugin.myLocale(player.getUniqueId()).challengesguiTitle)) {
    event.setCancelled(true);
    if (event.getSlotType() == SlotType.OUTSIDE) {
	player.closeInventory();
	return;
    }

    // Get the list of items in this inventory
    // plugin.getLogger().info("DEBUG: You clicked on slot " + slot);
    List<CPItem> challenges = plugin.getChallenges().getCP(player);
    if (challenges == null) {
	plugin.getLogger().warning("Player was accessing Challenge Inventory, but it had lost state - was server restarted?");
	player.closeInventory();
	player.performCommand(Settings.CHALLENGECOMMAND);
	return;
    }
    // plugin.getLogger().info("DEBUG: Challenges size = " +
    // challenges.size());
    if (slot >= 0 && slot < challenges.size()) {
	CPItem item = challenges.get(slot);
	// Check that it is the top items that are being clicked on
	// These two should be identical because it is made before
	if (clicked.equals(item.getItem())) {
	    // Next section indicates the level of panel to open
	    if (item.getNextSection() != null) {
		player.closeInventory();
		player.openInventory(plugin.getChallenges().challengePanel(player, item.getNextSection()));
	    } else if (item.getCommand() != null) {
		player.performCommand(item.getCommand());
		player.closeInventory();
		player.openInventory(plugin.getChallenges().challengePanel(player));
	    }
	}
    }
}
   }
 
开发者ID:tastybento,项目名称:askygrid,代码行数:46,代码来源:ChallengePanel.java

示例7: getSlotType

public static SlotType getSlotType(InventoryView inventory, int slot) {
    SlotType type = SlotType.CONTAINER;
    if (slot >= 0 && slot < inventory.getTopInventory().getSize()) {
        switch(inventory.getType()) {
        case FURNACE:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else if(slot == 1) {
                type = SlotType.FUEL;
            }
            break;
        case BREWING:
            if (slot == 3) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case ENCHANTING:
            type = SlotType.CRAFTING;
            break;
        case WORKBENCH:
        case CRAFTING:
            if (slot == 0) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case MERCHANT:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BEACON:
            type = SlotType.CRAFTING;
            break;
        case ANVIL:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        default:
            // Nothing to do, it's a CONTAINER slot
        }
    } else {
        if (slot == -999) {
            type = SlotType.OUTSIDE;
        } else if (inventory.getType() == InventoryType.CRAFTING && slot < 9) {
            type = SlotType.ARMOR;
        } else if (slot >= (inventory.countSlots() - 9)) {
            type = SlotType.QUICKBAR;
        }
    }
    return type;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:60,代码来源:CraftInventoryView.java

示例8: getSlotType

public static SlotType getSlotType(InventoryView inventory, int slot) {
    SlotType type = SlotType.CONTAINER;
    if (slot >= 0 && slot < inventory.getTopInventory().getSize()) {
        switch(inventory.getType()) {
        case FURNACE:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else if(slot == 1) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BREWING:
            if (slot == 3) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case ENCHANTING:
            type = SlotType.CRAFTING;
            break;
        case WORKBENCH:
        case CRAFTING:
            if (slot == 0) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case MERCHANT:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BEACON:
            type = SlotType.CRAFTING;
            break;
        case ANVIL:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        default:
            // Nothing to do, it's a CONTAINER slot
        }
    } else {
        if (slot == -999 || slot == -1) {
            type = SlotType.OUTSIDE;
        } else if (inventory.getType() == InventoryType.CRAFTING) {
            if (slot < 9) {
                type = SlotType.ARMOR;
            } else if (slot > 35) {
                type = SlotType.QUICKBAR;
            }
        } else if (slot >= (inventory.countSlots() - 9)) {
            type = SlotType.QUICKBAR;
        }
    }
    return type;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:66,代码来源:CraftInventoryView.java

示例9: getSlotType

public static SlotType getSlotType(InventoryView inventory, int slot) {
    SlotType type = SlotType.CONTAINER;
    if (slot < inventory.getTopInventory().getSize()) {
        switch(inventory.getType()) {
        case FURNACE:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else if(slot == 1) {
                type = SlotType.FUEL;
            }
            break;
        case BREWING:
            if (slot == 0) {
                type = SlotType.FUEL;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case ENCHANTING:
            type = SlotType.CRAFTING;
            break;
        case WORKBENCH:
        case CRAFTING:
            if (slot == 0) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case MERCHANT:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        case BEACON:
            type = SlotType.CRAFTING;
            break;
        case ANVIL:
            if (slot == 2) {
                type = SlotType.RESULT;
            } else {
                type = SlotType.CRAFTING;
            }
            break;
        default:
            // Nothing to do, it's a CONTAINER slot
        }
    } else {
        if (slot == -999) {
            type = SlotType.OUTSIDE;
        } else if (inventory.getType() == InventoryType.CRAFTING && slot < 9) {
            type = SlotType.ARMOR;
        } else if (slot >= (inventory.countSlots() - 9)) {
            type = SlotType.QUICKBAR;
        }
    }
    return type;
}
 
开发者ID:agaricusb,项目名称:MCPBukkit,代码行数:60,代码来源:CraftInventoryView.java

示例10: runInventoryChecks

public int runInventoryChecks(Player p, Inventory inv, InventoryAction ia, InventoryClickEvent event) {

        if (p.isBlocking() || p.isSneaking() || p.isSprinting() || p.isSleeping()) {

            if (this.vars.issueViolation(p, CheckType.IMPOSSIBLE_CLICK)) {

                return 1;

            }

        }

        long rdif = (System.currentTimeMillis() - this.getLastViolation(p.getName()));

        if (rdif <= 2000) {

            return 1;//Prevent abuse to bypass check

        }

        if (ia == InventoryAction.NOTHING) {//Who was the idiot that added this -_-

            return 0;

        }

        if (p.getGameMode() == GameMode.CREATIVE) {

            if (inv.getType() == InventoryType.PLAYER || inv.getType() == InventoryType.CREATIVE) {

                if (event.getSlotType() != SlotType.OUTSIDE) {//We want to check for fastdrops which in turn = lag

                    this.lastviolation.put(p.getName(), System.currentTimeMillis());

                    return 0;

                }

            }

        }

        if (Settings.debug) {

            Bukkit.broadcastMessage("Type: " + inv.getType() + "; Action: " + ia.toString().toLowerCase());

        }

        long diff = (System.currentTimeMillis() - this.getLastClicked(p.getName()));

        if (diff <= Settings.fcs) {

            if (this.vars.issueViolation(p, CheckType.SPEED_CLICK)) {

                return 1;

            }

        }

        this.lastclick.put(p.getName(), System.currentTimeMillis());

        return 0;

    }
 
开发者ID:johnnywoof,项目名称:NoHack,代码行数:65,代码来源:InventoryCheck.java


注:本文中的org.bukkit.event.inventory.InventoryType.SlotType.OUTSIDE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。