public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
java类org.bukkit.inventory.InventoryView的实例源码
CraftHumanEntity.java 文件源码
项目:Uranium
阅读 21
收藏 0
点赞 0
评论 0
CraftHumanEntity.java 文件源码
项目:Uranium
阅读 25
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:Uranium
阅读 21
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
WindowManager.java 文件源码
项目:ProjectAres
阅读 35
收藏 0
点赞 0
评论 0
/**
* Register the given {@link WindowListener} to receive notifications about the given {@link InventoryView}.
*/
public InventoryView registerWindow(WindowListener listener, InventoryView window) {
final Player player = (Player) window.getPlayer();
final View old = views.get(player);
if(old == null || !old.window.equals(window)) {
if(old != null) {
old.notifyClose();
}
final View view = new View(player, window, listener);
views.put(player, view);
view.notifyOpen();
}
return window;
}
ItemListener.java 文件源码
项目:RPGInventory
阅读 20
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.MONITOR)
public void afterEquipChange(final InventoryDragEvent event) {
final Player player = (Player) event.getWhoClicked();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
new BukkitRunnable() {
@Override
public void run() {
InventoryView inventoryView = event.getView();
for (int slot : event.getRawSlots()) {
ItemStack item = inventoryView.getItem(slot);
if (CustomItem.isCustomItem(item)) {
ItemManager.updateStats((Player) event.getWhoClicked());
}
}
}
}.runTaskLater(RPGInventory.getInstance(), 1);
}
CellSpawner.java 文件源码
项目:AgarMC
阅读 17
收藏 0
点赞 0
评论 0
@Override
public void run() {
AgarMC plugin = AgarMC.get();
if (plugin.getGame().getPlayers().isEmpty())
return ;
if(plugin.getGame().getVirus().size() < plugin.getGame().getMaxVirus()) {
VirusCell virus = new VirusCell(Utils.randomLocation(plugin.getGame().getOrigin().getX(), plugin.getGame().getDimensions()), Utils.randomLocation(plugin.getGame().getOrigin().getZ(), plugin.getGame().getDimensions()));
plugin.getGame().addVirus(virus);
}
for (CPlayer player : plugin.getGame().getPlayers())
{
player.getPlayer().getInventory().setItem(1, updateColorBlock(player.getPlayer().getInventory().getItem(1)));
InventoryView iv = player.getPlayer().getOpenInventory();
if (iv == null)
continue ;
Inventory i = iv.getTopInventory();
if (i == null || !i.getName().equals(MenuGui.INV_NAME))
continue ;
i.setItem(0, updateColorBlock(i.getItem(0)));
}
}
AbilityListener.java 文件源码
项目:AsgardAscension
阅读 22
收藏 0
点赞 0
评论 0
@EventHandler
public void onRepair(InventoryClickEvent event) {
if(event.isCancelled() || !(event.getWhoClicked() instanceof Player) || !(event.getInventory() instanceof AnvilInventory))
return;
InventoryView view = event.getView();
int rawSlot = event.getRawSlot();
if(rawSlot != view.convertSlot(rawSlot) || rawSlot != 2)
return;
ItemStack item = event.getInventory().getItem(0);
if(!plugin.getAbilityManager().hasAbility(item) || !plugin.getAbilityManager().isTemporaryItem(item))
return;
Ability ability = plugin.getAbilityManager().getAbility(item);
event.getInventory().setItem(0, plugin.getAbilityManager().removeItemLore(item, ability));
event.setCancelled(true);
}
CraftHumanEntity.java 文件源码
项目:ThermosRebased
阅读 22
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:ThermosRebased
阅读 19
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:ThermosRebased
阅读 20
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
InventoryDragEvent.java 文件源码
项目:Thermos-Bukkit
阅读 24
收藏 0
点赞 0
评论 0
public InventoryDragEvent(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) {
super(what);
Validate.notNull(oldCursor);
Validate.notNull(slots);
type = right ? DragType.SINGLE : DragType.EVEN;
this.newCursor = newCursor;
this.oldCursor = oldCursor;
this.addedItems = slots;
ImmutableSet.Builder<Integer> b = ImmutableSet.builder();
for (Integer slot : slots.keySet()) {
b.add(what.convertSlot(slot));
}
this.containerSlots = b.build();
}
Perk.java 文件源码
项目:Breakpoint
阅读 24
收藏 0
点赞 0
评论 0
public static InventoryView showPerkMenu(BPPlayer bpPlayer)
{
Player player = bpPlayer.getPlayer();
List<Perk> perks = bpPlayer.getPerks();
if(perks.size() <= 0)
{
player.sendMessage(MessageType.MENU_PERKS_EMPTY.getTranslation().getValue());
return null;
}
int rows = bpPlayer.getPerkInventoryRows();
Inventory inv = Bukkit.getServer().createInventory(player, 9 * rows, MENU_TITLE);
equipMenu(bpPlayer, inv);
player.closeInventory();
return player.openInventory(inv);
}
CraftHumanEntity.java 文件源码
项目:Thermos
阅读 21
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:Thermos
阅读 19
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:KCauldron
阅读 25
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:KCauldron
阅读 20
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:Craftbukkit
阅读 19
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
CraftContainer.java 文件源码
项目:KCauldron
阅读 20
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
InventoryDragEvent.java 文件源码
项目:CauldronGit
阅读 21
收藏 0
点赞 0
评论 0
public InventoryDragEvent(InventoryView what, ItemStack newCursor, ItemStack oldCursor, boolean right, Map<Integer, ItemStack> slots) {
super(what);
Validate.notNull(oldCursor);
Validate.notNull(slots);
type = right ? DragType.SINGLE : DragType.EVEN;
this.newCursor = newCursor;
this.oldCursor = oldCursor;
this.addedItems = slots;
ImmutableSet.Builder<Integer> b = ImmutableSet.builder();
for (Integer slot : slots.keySet()) {
b.add(what.convertSlot(slot));
}
this.containerSlots = b.build();
}
CraftHumanEntity.java 文件源码
项目:CauldronGit
阅读 17
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:CauldronGit
阅读 21
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:CauldronGit
阅读 42
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
CraftHumanEntity.java 文件源码
项目:Craftbukkit
阅读 21
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().openTileEntity(new BlockWorkbench.TileEntityContainerWorkbench(getHandle().world, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())));
if (force) {
getHandle().activeContainer.checkReachable = false;
}
return getHandle().activeContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:Cauldron-Old
阅读 20
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:Cauldron-Old
阅读 22
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:Cauldron-Old
阅读 21
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
CraftHumanEntity.java 文件源码
项目:Cauldron-Reloaded
阅读 19
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftHumanEntity.java 文件源码
项目:Cauldron-Reloaded
阅读 20
收藏 0
点赞 0
评论 0
public InventoryView openEnchanting(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.ENCHANTMENT_TABLE) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIEnchantment(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}
CraftContainer.java 文件源码
项目:Cauldron-Reloaded
阅读 20
收藏 0
点赞 0
评论 0
public CraftContainer(final Inventory inventory, final HumanEntity player, int id) {
this(new InventoryView() {
@Override
public Inventory getTopInventory() {
return inventory;
}
@Override
public Inventory getBottomInventory() {
return player.getInventory();
}
@Override
public HumanEntity getPlayer() {
return player;
}
@Override
public InventoryType getType() {
return inventory.getType();
}
}, id);
}
CraftHumanEntity.java 文件源码
项目:FFoKC
阅读 19
收藏 0
点赞 0
评论 0
public InventoryView openWorkbench(Location location, boolean force) {
if (!force) {
Block block = location.getBlock();
if (block.getType() != Material.WORKBENCH) {
return null;
}
}
if (location == null) {
location = getLocation();
}
getHandle().displayGUIWorkbench(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) {
getHandle().openContainer.checkReachable = false;
}
return getHandle().openContainer.getBukkitView();
}