help making new thing to my FFA plugin.

Discussion in 'Plugin Development' started by digitox, Apr 20, 2017.

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

    digitox

    I need help with a setting a region. i need to code a plugin that could set a region that protects the things in the region. but players can still place blocks(and break the block that they have placed). every 15 min all the blocks that have been placed will be removed.

    I need help whit making a plugin that will refill chests whit a some stuff every 5 min.
    i have coded it but there is an error.
    Code:
    package me.digitox.kistekrigen.events;
    
    
    
    import java.util.Random;
    
    
    
    import org.bukkit.Bukkit;
    
    import org.bukkit.Chunk;
    
    import org.bukkit.Material;
    
    import org.bukkit.World;
    
    import org.bukkit.block.BlockState;
    
    import org.bukkit.block.Chest;
    
    import org.bukkit.inventory.Inventory;
    
    import org.bukkit.inventory.ItemStack;
    
    
    
    publicclass refill {
    
       
    
        public static ItemStack randomMaterial(){
    
            chest.clear();
    
    
    
            chest.add(new ItemStack(Material.ARROW, 2));
    
            chest.add(new ItemStack(Material.GOLDEN_APPLE, 2));
    
            chest.add(new ItemStack(Material.WOOD_SWORD, 1));
    
            chest.add(new ItemStack(Material.IRON_HELMET));
    
            chest.add(new ItemStack(Material.IRON_CHESTPLATE));
    
            chest.add(new ItemStack(Material.IRON_LEGGINGS));
    
            chest.add(new ItemStack(Material.IRON_BOOTS));
    
            chest.add(new ItemStack(Material.CHAINMAIL_HELMET));
    
            chest.add(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
    
            chest.add(new ItemStack(Material.CHAINMAIL_LEGGINGS));
    
            chest.add(new ItemStack(Material.CHAINMAIL_BOOTS));
    
            Random r = new Random();
    
            ItemStack rand = new ItemStack(chest.get(r.nextInt()));
    
            return rand;
    
        }
    
    
    
        public static void fill(Inventory inv){
    
            inv.clear();
    
            for(int i = 0; i <= 26; i++){
    
                Random r = new Random();
    
    
    
                if(i == r.nextInt(26)){
    
                    inv.setItem(i, randomMaterial());
    
                }
    
            }
    
        }
    
    
    
        public static void blocks(){
    
            for (World w : Bukkit.getWorlds()){
    
                for(Chunk c : w.getLoadedChunks()){
    
                    for(BlockState b : c.getTileEntities()){
    
                        if(b instanceof Chest){
    
                            Inventory inv = ((Chest) b).getBlockInventory();
    
                            fill(inv);
    
                        }
    
                    }
    
                }
    
            }
    
        }
    
    
    
    }
    
    
    i need help whit making a build hight. just the players that have permission Build.build can build over that
    the command should be /setbh. then you set the build hight at you Y location.
     
  2. Offline

    digitox

    Bump?
     
  3. Offline

    i3ick

    1st question.

    If what you're trying to do is reset an arena after a game is over (when players aren't playing in it) you could have the arena be a schematic. then after every game you just load the schematic over the old one. Since air is technically a block it will override any blocks placed in the arena.

    If you need to reset while players are in put all active players in an arraylist and log the blocks they placed. Place these coords in an arraylist and replace them with air or wathever when you need to. Remember that if the server crashes you'll loose your coords so either save them to a file or reload the arena schematic.

    2nd question
    I don't have time to read through your code. Post the error, highlight the line it's in.
     
  4. Offline

    digitox

    its like ffa the game never end.

    i need help making a new chest fill. because i wount work.
     
Thread Status:
Not open for further replies.

Share This Page