How to ignore messages from commands?

Discussion in 'Plugin Development' started by kreashenz, Mar 28, 2013.

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

    hockeygoalie5

    Create a field:
    Code:
    ArrayList<Player> onDuty = new ArrayList<Player>();
    
    The /onduty command:
    Code:
    // Make sure command wasn't sent by console
    if(sender instanceof Player) {
        Player p = (Player) sender;
        // If player's an op and is not currently on duty
        if(p.isOp() && !onDuty.contains(p)) {
            // Put the player on duty
             onDuty.add(p);
        }
    }
    
    And your /offduty command:
    Code:
    if(sender instanceof Player) {
        Player p = (Player) sender;
        // If player's an op and is currently on duty
        if(p.isOp() && onDuty.contains(p)) {
            // Put the player off duty
             onDuty.remove(p);
        }
    }
    
     
Thread Status:
Not open for further replies.

Share This Page