I need help making a supply crate

Discussion in 'Plugin Development' started by VinexAx789, Jun 16, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    VinexAx789

    I'm pretty sure I have this completely screwed up what I want to do is I want a player to get an item named "Support Drop (Call Me In)" it's a redstone dust the player places it down the redstone dust disappears then a chest falls from the sky and when it hits the ground it makes a sound here's my code:

    Code:
    } else if (killstrk == 4) {
                        if (event.getEntity() instanceof FallingBlock) {
                            FallingBlock block = (FallingBlock) event.getEntity();
                            if (block.getMaterial() == Material.CHEST) {
                                for (Player p : Bukkit.getOnlinePlayers()) {
                                    p.playSound(p.getLocation(), Sound.BLAZE_DEATH, 50F, 50F);
                                    if (playerChestLocation
                                            .containsKey(p.getName())) {
                                        Location chestLoc = playerChestLocation
                                                .get(p.getName());
                                        chestLoc = chestLoc.getWorld()
                                                .getHighestBlockAt(chestLoc)
                                                .getLocation();
                                        chestholo = HolographicDisplaysAPI.createHologram(this, chestLoc);
                                        chestholo.addLine(ChatColor.RED + "Supply Crate");
                                        chestholo.update();
                                        Location loc = block.getLocation();
                                        if (chestLoc.getBlockX() == loc.getBlockX()
                                                && chestLoc.getBlockY() == loc
                                                        .getBlockY()
                                                && chestLoc.getBlockZ() == loc
                                                        .getBlockZ()) {
                                            Block blockChest = loc.getWorld()
                                                    .getHighestBlockAt(loc);
                                            Chest chest = (Chest) blockChest
                                                    .getState();
                                            ItemStack item = new ItemStack(
                                                    Material.DIAMOND_CHESTPLATE);
                                            ItemStack item2 = new ItemStack(Material.COOKED_BEEF);
                                            item.setAmount(1);
                                            item.setAmount(2);
                                            chest.getInventory().addItem(item);
                                            chest.getInventory().addItem(item2);
    So what I need to do is to have a player place down a redstone dust named "Support Drop (Call Me In)" then they place it once they place it a chest with drop with items inside of it when it hits the ground it will trigger a sound and have a hologram on the top of it when the items have been taking from it it will disappear in like 30 seconds. Any help?



    I'm in need of help fast

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  2. Offline

    HappyCow

    you should try to debug it by small parts, never debug it once after completing many stuffs and make it very complicated

    EDIT: ahh... I misunderstood you... nvm
     
    Last edited: Jun 16, 2015
  3. Offline

    VinexAx789

Thread Status:
Not open for further replies.

Share This Page