Has it changed?

Discussion in 'Plugin Development' started by Saturisk, Mar 4, 2011.

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

    Saturisk

    Code:
    public void setFire(Player player){
    
        String[] s;
        Event event = event.getPlayer();
    
        if(event.getPlayer().isOp() && s[0].equalsIgnoreCase("/fire")){
            //Define a variable of type Player for storing the person to set on fire (initially set to null).
            Player target = null;
            //Check whether there command includes an extra argument for player name
            if(s.length > 1)
                //If so, set target to be the player with the name given
                target = event.getPlayer().getServer().getPlayer(s[1]);
            //if by this point target is still equal to null, either a name argument wasn't supplied or there was no player with that name.
            if(target == null)
                //in that case, target the player calling the command.
                target = event.getPlayer();
            //set target on fire.
            target.setFireTicks(100);
    
        }
    
        }
    My events aren't working, and they used to, what has changed that i need to fix? Can anyone tell my what's wrong? (With the events)

    And side note, did i set up my strings right?
    I'm trying to get it so when you type in: '/fire <player name>' it lights that player on fire.
     
  2. Offline

    Edward Hand

    First:
    Code:
    Event event = event.getPlayer();
    again, where is event defined?

    Second:
    Code:
    String[] s;
    should be
    Code:
    String[] s = something.split(" ");
     
  3. Offline

    Saturisk

    Yeah, i got yelled at for that by plague XD Thanks though.
     
Thread Status:
Not open for further replies.

Share This Page