Did someone know a better area regenerate as my?

Discussion in 'Plugin Development' started by lgplay, Apr 16, 2017.

Thread Status:
Not open for further replies.
  1. Code:
    Bukkit.getScheduler().runTask(plug, new Runnable() {
                @SuppressWarnings("deprecation")
                @Override
                public void run() {
                    for(String s : Map){
                        String[] BlockData = s.split(":");
                        int id = Integer.parseInt(BlockData[0]);
                        byte data = Byte.parseByte(BlockData[1]);
                        World w = Bukkit.getWorld(BlockData[2]);
                        int x = Integer.parseInt(BlockData[3]);
                        int y = Integer.parseInt(BlockData[4]);
                        int z = Integer.parseInt(BlockData[5]);
                        Block b = w.getBlockAt(x, y, z);
                        b.setTypeIdAndData(id, data, true);
                        if(b.getType().equals(Material.STONE)){
                            if(b.getData()==3)
                                continue;
                            int Ran = new Random().nextInt(30);
                            if(Ran == 9){
                                w.getBlockAt(x, y, z).setType(Material.IRON_ORE);
                                continue;
                            }else if(Ran == 5){
                                w.getBlockAt(x, y, z).setType(Material.COAL_ORE);;
                            }
                        }
                        if(!w.getBlockAt(x, y, z).equals(b)){
                            w.getBlockAt(x, y, z).setTypeIdAndData(id,data,true);
                        }
                    }State = GameState.Lobby;
                }
            });
     
  2. Offline

    timtower Administrator Administrator Moderator

    @lgplay Is this to regenerate a part of the world or an arena?
    If a part of the world: get the actual generator involved, might be setup to have no ores in it.
     
  3. part but I need the ores

    part and I need the ores

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Apr 18, 2017
Thread Status:
Not open for further replies.

Share This Page