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


Java CraftEventFactory.callInventoryOpenEvent方法代码示例

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


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

示例1: openContainer

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openContainer(IInventory iinventory) {
    if (this.activeContainer != this.defaultContainer) {
        this.closeInventory();
    }

    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
    if (container == null) {
        iinventory.closeContainer();
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 0, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_()));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:20,代码来源:EntityPlayer.java

示例2: openHorseInventory

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
    if (container == null) {
        iinventory.closeContainer();
        return;
    }
    // CraftBukkit end

    if (this.activeContainer != this.defaultContainer) {
        this.closeInventory();
    }

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 11, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_(), entityhorse.getId()));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:20,代码来源:EntityPlayer.java

示例3: openCustomInventory

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
private void openCustomInventory(Inventory inventory, EntityPlayer player, String windowType) {
    if (player.playerConnection == null) return;
    Container container = new CraftContainer(inventory, this, player.nextContainerCounter());

    container = CraftEventFactory.callInventoryOpenEvent(player, container);
    if(container == null) return;

    String title = container.getBukkitView().getTitle();
    int size = container.getBukkitView().getTopInventory().getSize();

    // Special cases
    if (windowType.equals("minecraft:crafting_table") 
            || windowType.equals("minecraft:anvil")
            || windowType.equals("minecraft:enchanting_table")
            ) {
        size = 0;
    }

    player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title), size));
    getHandle().activeContainer = container;
    getHandle().activeContainer.addSlotListener(player);
}
 
开发者ID:tgnmc,项目名称:Craftbukkit,代码行数:23,代码来源:CraftHumanEntity.java

示例4: displayGUIChest

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void displayGUIChest(IInventory p_71007_1_)
{
    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, p_71007_1_));

    if (container == null)
    {
        p_71007_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 0, p_71007_1_.getInventoryName(), p_71007_1_.getSizeInventory(), p_71007_1_.hasCustomInventoryName()));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:24,代码来源:EntityPlayerMP.java

示例5: displayGUIAnvil

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void displayGUIAnvil(int p_82244_1_, int p_82244_2_, int p_82244_3_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerRepair(this.inventory, this.worldObj, p_82244_1_, p_82244_2_, p_82244_3_, this));

    if (container == null)
    {
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 8, "Repairing", 9, true));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:18,代码来源:EntityPlayerMP.java

示例6: func_146093_a

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void func_146093_a(TileEntityHopper p_146093_1_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, p_146093_1_));

    if (container == null)
    {
        p_146093_1_.closeInventory(); // Cauldron - prevent chest from being stuck in open state on clients
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 9, p_146093_1_.getInventoryName(), p_146093_1_.getSizeInventory(), p_146093_1_.hasCustomInventoryName()));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:19,代码来源:EntityPlayerMP.java

示例7: openHorseInventory

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
    if(container == null) return;
    // CraftBukkit end

    if (this.activeContainer != this.defaultContainer) {
        this.closeInventory();
    }

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 11, iinventory.getName(), iinventory.getSize(), iinventory.c(), entityhorse.id));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:17,代码来源:EntityPlayer.java

示例8: displayGUIWorkbench

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void displayGUIWorkbench(int p_71058_1_, int p_71058_2_, int p_71058_3_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.worldObj, p_71058_1_, p_71058_2_, p_71058_3_));

    if (container == null)
    {
        return;
    }

    // CraftBukkit end
    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 1, "Crafting", 9, true));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:18,代码来源:EntityPlayerMP.java

示例9: openCustomInventory

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
private void openCustomInventory(Inventory inventory, net.minecraft.entity.player.EntityPlayerMP player, int windowType) {
    if (player.playerNetServerHandler == null) return;
    net.minecraft.inventory.Container container = new CraftContainer(inventory, this, player.nextContainerCounter());

    container = CraftEventFactory.callInventoryOpenEvent(player, container);
    if(container == null) return;

    String title = container.getBukkitView().getTitle();
    int size = container.getBukkitView().getTopInventory().getSize();

    player.playerNetServerHandler.sendPacket(new net.minecraft.network.play.server.S2DPacketOpenWindow(container.windowId, windowType, title, size, true));
    getHandle().openContainer = container;
    getHandle().openContainer.addCraftingToCrafters(player);
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:15,代码来源:CraftHumanEntity.java

示例10: openCustomInventory

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
private void openCustomInventory(Inventory inventory, EntityPlayer player, int windowType) {
    if (player.playerConnection == null) return;
    Container container = new CraftContainer(inventory, this, player.nextContainerCounter());

    container = CraftEventFactory.callInventoryOpenEvent(player, container);
    if(container == null) return;

    String title = container.getBukkitView().getTitle();
    int size = container.getBukkitView().getTopInventory().getSize();

    player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, title, size, true));
    getHandle().activeContainer = container;
    getHandle().activeContainer.addSlotListener(player);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:CraftHumanEntity.java

示例11: startCrafting

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void startCrafting(int i, int j, int k) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
    if (container == null) {
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:EntityPlayer.java

示例12: startEnchanting

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void startEnchanting(int i, int j, int k, String s) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
    if (container == null) {
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:EntityPlayer.java

示例13: openAnvil

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openAnvil(int i, int j, int k) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this));
    if (container == null) {
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:15,代码来源:EntityPlayer.java

示例14: openHopper

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openHopper(TileEntityHopper tileentityhopper) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
    if (container == null) {
        tileentityhopper.closeContainer();
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, tileentityhopper.getInventoryName(), tileentityhopper.getSize(), tileentityhopper.k_()));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:16,代码来源:EntityPlayer.java

示例15: openMinecartHopper

import org.bukkit.craftbukkit.event.CraftEventFactory; //导入方法依赖的package包/类
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
    if (container == null) {
        entityminecarthopper.closeContainer();
        return;
    }
    // CraftBukkit end

    this.nextContainerCounter();
    this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, entityminecarthopper.getInventoryName(), entityminecarthopper.getSize(), entityminecarthopper.k_()));
    this.activeContainer = container; // CraftBukkit - Use container we passed to event
    this.activeContainer.windowId = this.containerCounter;
    this.activeContainer.addSlotListener(this);
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:16,代码来源:EntityPlayer.java


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