Lava float out of map

Discussion in 'Plugin Development' started by metincasper, Nov 3, 2014.

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

    metincasper

    Hi :)
    I'm making a little minigame with 2 team. A RED team and a BLUE team.
    Both of the teams have a core with lava inside it. If the lava in red RED teams core float out of the map the BLUE teams win.

    So, does anybody knows how to check if the lava is float out of the map and check wich team that wins and lose.
    A early thanks :)
     
  2. Offline

    Lolmewn

    Pretty sure there's a BlockForm event or something for Lava/Water, then get the block of that event and check the location (y==1).
     
  3. Offline

    metincasper

    Okay thanks i will try that :)

    So now i tried it but it didnt work.
    Here is my code for the EventHandler
    Code:
        @EventHandler
        public void bimsetest(BlockFormEvent e) {
            if (e.getBlock().getType() == Material.WATER) {
                if (e.getBlock().getLocation().getY() == 1 ) {
                    Bukkit.getServer().broadcastMessage("Water works");
                }
            }
        }
    EDIT: i tried to do this so its send a message if something Formes

    Code:
        @EventHandler
        public void bimsetest(BlockFormEvent e) {
            Bukkit.getServer().broadcastMessage("BlockFormer tester");
        }
    But the message didnt come

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

    SleepyDog

    Keep a loop running on the block that you want to check for lava, when the lava is detected make it do the code you want.


    I am not spoon feeding you, go look up how to do the rest,=.



    public void checkforlava {
    if (blockisdetected){
    (reset map)
    (tp winners to winner point)
    (tp loosers to loser point)
    (message winners)
    (message loosers)
    (reward winners)
    (announce gave is over)

    }
    else {
    checkforlava();

    }


    }
     
  5. Offline

    fireblast709

    BlockFromToEvent?
     
  6. Offline

    metincasper

    @SleepyDog I did not understand that u said. Can u pleas give me a little spoon?
    @fireblast709 I tried to do this, but it didnt work at all
    Code:
        @EventHandler
        public void winner(BlockFromToEvent e) {
            if (e.getBlock().getType() == Material.LAVA) {
                if (e.getBlock().getLocation().getBlockY() == 1) {
                    Bukkit.broadcastMessage("Working!");
                }
            }
        }
     
  7. Offline

    Barinade

    I'm assuming it's like an overflow thing, a 1 block tower of lava that slowly raises
    If this is the case:
    Lets say you have 10 blocks before it flows out, the opposing team needs to do something 10 times to make it flow out, So you add the score (x/10) to the Y coordinate of the starting lava source and set that block to a lava source

    Location redCore = someLocation;
    Location blueCore = someOtherLocation;
    int blueScore = 5;
    int redScore = 7;
    void blueScored() {
    redCore.add(0,blueScore,0).getBlock().setType(Material.LAVA); //Or stationary lava, idk
    //This may mutate the original location, I'm not sure. Just create a copy of the location and modify that if it does.
    }
    void redScored() {
    blueCore.add(0,redScore,0).getBlock().setType(Material.LAVA);
    }
     
  8. Offline

    metincasper

    @Barinade
    When does i have to call blueScored() and redScored()?
     
Thread Status:
Not open for further replies.

Share This Page