Flying Blocks

Discussion in 'Plugin Development' started by FrodoNihal, Sep 15, 2014.

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

    FrodoNihal

    Hey guys

    I try to develop my first minecraft plugin.

    The idea was that you can stay on One block, look at it, type one command and the block change the Position vertically. Like an easy elevator. But I cant find something in the Bukket API or in the internet to solve this problem.

    I'm afraid the Block object hasn't the ability to change their location.

    I hope you have an idea how to move a block vertically.
     
  2. Offline

    jojo1541

    Change he Location one tile higher set the Blocktype at the new Location to your desired blocktype and teleport the player to the new location. (and set the Block at the old Location to Air)
     
  3. Offline

    seethingword

    Try making a plugin that works with WorldEdit and automatically selects the block and moves it vertical.
     
  4. Offline

    4thegame3

    easy. put this code in a async task
    Code:
    Location loc = p.getLocation().add(0,-1,0);
                        Block block = loc.getBlock();
                        for (int i = 0; i < 5; i++) {
                            Material type = block.getType();
                            block.setType(Material.AIR);
                            block = loc.add(0, i, 0).getBlock();
                            block.setType(type);
                            try {
                                Thread.sleep(200);
                            } catch (InterruptedException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                            }
                        }
    let me know if works

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 14, 2016
  5. 4thegame3
    You shouldn't do Bukkit API calls in an Async task. Just use a sync repeating task.
     
  6. Offline

    FrodoNihal

    Wow you answer my question quite fast.

    The code example works! (if you teleport the player when the block material is changing)

    Thanks for help :)
     
  7. Offline

    stoneminer02

    Don't use Thread.sleep();
    Use some sort of functions that you made, add it to your code everywhere and then if its enabled then just stop it, else continue.
     
Thread Status:
Not open for further replies.

Share This Page