Search in sources :

Example 1 with org.bukkit.craftbukkit.v1_8_R3.inventory

use of org.bukkit.craftbukkit.v1_8_R3.inventory in project PublicCrafters by BananaPuncher714.

the class ContainerManager_v1_8_R3 method getLocation.

public Location getLocation(Inventory inventory) {
    if (inventory == null) {
        return null;
    }
    if (!(inventory instanceof CraftInventory)) {
        return null;
    }
    try {
        Field ic = CraftInventory.class.getDeclaredField("inventory");
        ic.setAccessible(true);
        Object crafting = ic.get(inventory);
        if (crafting instanceof CustomInventoryCrafting) {
            CustomInventoryCrafting table = (CustomInventoryCrafting) crafting;
            return table.getLocation();
        }
    } catch (Exception exception) {
        exception.printStackTrace();
    }
    return null;
}
Also used : CraftInventory(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory) Field(java.lang.reflect.Field)

Example 2 with org.bukkit.craftbukkit.v1_8_R3.inventory

use of org.bukkit.craftbukkit.v1_8_R3.inventory in project FireAPI by FireBlade-Serv.

the class EventsAT method onRightClick.

@EventHandler
public void onRightClick(PlayerInteractEvent e) {
    final Player p = e.getPlayer();
    final Action a = e.getAction();
    FirePlayer fp = new FirePlayer(p, this.api);
    ItemStack adminStick = new ItemStack(Material.STICK);
    ItemMeta adminStickMeta = adminStick.getItemMeta();
    adminStickMeta.setDisplayName(ChatColor.DARK_BLUE + "AdminStick");
    adminStick.setItemMeta(adminStickMeta);
    if (fp.hasRankAndSup(Rank.MODÉRATEUR)) {
        if (a.equals(Action.RIGHT_CLICK_AIR) || a.equals(Action.RIGHT_CLICK_BLOCK)) {
            if (p.getInventory().getItemInHand().equals(adminStick)) {
                Inventory i1 = Bukkit.createInventory(null, 27, ChatColor.GOLD + "AdminTools");
                i1.setItem(1, generateItem(Material.STONE_AXE, ChatColor.DARK_RED + "Gamemode Survie"));
                i1.setItem(3, generateItem(Material.GRASS, ChatColor.DARK_GREEN + "Gamemode Créatif"));
                i1.setItem(5, generateItem(Material.IRON_SWORD, ChatColor.GOLD + "Gamemode Aventure"));
                i1.setItem(7, generateItem(Material.GLASS, ChatColor.GRAY + "Gamemode Spectateur"));
                i1.setItem(9, adminToolsLogo("_goldocelot_"));
                i1.setItem(13, generateItem(Material.PAPER, ChatColor.WHITE + "Ouvrir l'AdminList"));
                i1.setItem(19, generatePotItem(PotionType.INVISIBILITY, ChatColor.WHITE + "Activer/Desactiver le vanish"));
                i1.setItem(21, generatePotItem(PotionType.INSTANT_HEAL, ChatColor.LIGHT_PURPLE + "Se heal"));
                i1.setItem(23, generateItem(Material.COOKED_BEEF, ChatColor.GREEN + "Se feed"));
                i1.setItem(25, generatePotItem(PotionType.SPEED, ChatColor.BLUE + "Activer/Desactiver le fly speed"));
                p.openInventory(i1);
            }
        }
    }
}
Also used : FirePlayer(fr.glowstoner.fireapi.player.FirePlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) Action(org.bukkit.event.block.Action) FirePlayer(fr.glowstoner.fireapi.player.FirePlayer) ItemStack(org.bukkit.inventory.ItemStack) ItemMeta(org.bukkit.inventory.meta.ItemMeta) Inventory(org.bukkit.inventory.Inventory) EventHandler(org.bukkit.event.EventHandler)

Example 3 with org.bukkit.craftbukkit.v1_8_R3.inventory

use of org.bukkit.craftbukkit.v1_8_R3.inventory in project FireAPI by FireBlade-Serv.

the class EventsAT method createInventory.

public static void createInventory(Player p, int page) {
    Inventory inv = Bukkit.createInventory(null, 54, ChatColor.WHITE + "AdminList");
    for (int i = 0; i < 45; i++) {
        Player target;
        try {
            target = pCo.get(0);
            inv.setItem(i, generateSkull(target.getName()));
            pCo.remove(target);
        } catch (IndexOutOfBoundsException ex) {
            break;
        }
    }
    int pMod = pCo.size() % 45;
    int pa = pCo.size() / 45;
    if (pMod != 0) {
        pa++;
    }
    if (pa == 0 && page == 1) {
        inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
        inv.setItem(49, adminToolsLogo("Glowstoner"));
        p.openInventory(inv);
    } else if (page == 1) {
        inv.setItem(53, generateItem(Material.PAPER, ChatColor.AQUA + "Suivant"));
        inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
        inv.setItem(49, adminToolsLogo("Glowstoner"));
        p.openInventory(inv);
    } else if (page == pa) {
        inv.setItem(45, generateItem(Material.PAPER, ChatColor.AQUA + "Précédent"));
        inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
        inv.setItem(49, adminToolsLogo("Glowstoner"));
        p.openInventory(inv);
    } else {
        inv.setItem(53, generateItem(Material.PAPER, ChatColor.AQUA + "Suivant"));
        inv.setItem(46, generateItem(Material.HOPPER, ChatColor.DARK_GREEN + "Rechercher"));
        inv.setItem(49, adminToolsLogo("Glowstoner"));
        inv.setItem(45, generateItem(Material.PAPER, ChatColor.AQUA + "Précédent"));
        p.openInventory(inv);
    }
}
Also used : FirePlayer(fr.glowstoner.fireapi.player.FirePlayer) Player(org.bukkit.entity.Player) CraftPlayer(org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer) Inventory(org.bukkit.inventory.Inventory)

Example 4 with org.bukkit.craftbukkit.v1_8_R3.inventory

use of org.bukkit.craftbukkit.v1_8_R3.inventory in project Atlas by funkemunky.

the class BlockBox1_8_R3 method getCollisionBox.

@Override
public CollisionBox getCollisionBox(Block block) {
    final net.minecraft.server.v1_8_R3.World world = ((org.bukkit.craftbukkit.v1_8_R3.CraftWorld) block.getWorld()).getHandle();
    final int x = block.getX(), y = block.getY(), z = block.getZ();
    final AxisAlignedBB collide = BlockBoxManager.cbox.copy().offset(x, y, z).toAxisAlignedBB();
    List<AxisAlignedBB> boxes = new ArrayList<>();
    net.minecraft.server.v1_8_R3.Block vblock = CraftMagicNumbers.getBlock(block);
    net.minecraft.server.v1_8_R3.BlockPosition blockPos = new net.minecraft.server.v1_8_R3.BlockPosition(x, y, z);
    vblock.a(world, blockPos, vblock.getBlockData(), collide, boxes, null);
    if (boxes.size() == 0) {
        AxisAlignedBB box = vblock.a(world, blockPos, vblock.getBlockData());
        if (box != null) {
            return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
        } else
            return NoCollisionBox.INSTANCE;
    } else if (boxes.size() == 1) {
        AxisAlignedBB box = boxes.get(0);
        return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
    } else {
        ComplexCollisionBox complexBox = new ComplexCollisionBox();
        for (AxisAlignedBB box : boxes) {
            complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
        }
        return complexBox;
    }
}
Also used : AxisAlignedBB(net.minecraft.server.v1_8_R3.AxisAlignedBB) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) ArrayList(java.util.ArrayList) ComplexCollisionBox(cc.funkemunky.api.utils.world.types.ComplexCollisionBox) SimpleCollisionBox(cc.funkemunky.api.utils.world.types.SimpleCollisionBox) BlockPosition(net.minecraft.server.v1_8_R3.BlockPosition) CraftWorld(org.bukkit.craftbukkit.v1_8_R3.CraftWorld)

Example 5 with org.bukkit.craftbukkit.v1_8_R3.inventory

use of org.bukkit.craftbukkit.v1_8_R3.inventory in project Denizen-For-Bukkit by DenizenScript.

the class ImprovedOfflinePlayer_v1_8_R3 method getEnderChest.

@Override
public Inventory getEnderChest() {
    if (offlineEnderChests.containsKey(getUniqueId())) {
        return offlineEnderChests.get(getUniqueId());
    }
    InventoryEnderChest endchest = new InventoryEnderChest();
    endchest.a(((CompoundTag_v1_8_R3) this.compound).toNMSTag().getList("EnderItems", 10));
    Inventory inv = new CraftInventory(endchest);
    offlineEnderChests.put(getUniqueId(), inv);
    return inv;
}
Also used : CraftInventory(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory) CompoundTag_v1_8_R3(net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_8_R3) CraftInventory(org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory) Inventory(org.bukkit.inventory.Inventory)

Aggregations

CraftPlayer (org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer)6 Inventory (org.bukkit.inventory.Inventory)5 FirePlayer (fr.glowstoner.fireapi.player.FirePlayer)4 Player (org.bukkit.entity.Player)4 ItemStack (org.bukkit.inventory.ItemStack)4 CraftItemStack (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack)3 EventHandler (org.bukkit.event.EventHandler)3 ItemMeta (org.bukkit.inventory.meta.ItemMeta)3 CompoundTag_v1_8_R3 (net.aufdemrand.denizen.nms.impl.jnbt.CompoundTag_v1_8_R3)2 ItemStack (net.minecraft.server.v1_8_R3.ItemStack)2 CraftInventory (org.bukkit.craftbukkit.v1_8_R3.inventory.CraftInventory)2 ComplexCollisionBox (cc.funkemunky.api.utils.world.types.ComplexCollisionBox)1 SimpleCollisionBox (cc.funkemunky.api.utils.world.types.SimpleCollisionBox)1 TileEntityContainer (com.bgsoftware.wildchests.objects.containers.TileEntityContainer)1 WildItemStack (com.bgsoftware.wildchests.objects.inventory.WildItemStack)1 FireTitle (fr.glowstoner.fireapi.bukkit.nms.title.FireTitle)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 AxisAlignedBB (net.minecraft.server.v1_8_R3.AxisAlignedBB)1 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)1