Package wzhybridbots.security

Examples of wzhybridbots.security.BotOperator


        map.put( operator.getOperatorName(), operator );
      }
    }
    else {
      // Get the bot operator object in the container
      BotOperator oldOperator = (BotOperator)map.get( operator.getOperatorName() );
      if ( oldOperator == null ) { throw new NullPointerException(); }
     
      // Resolve the conflict
      BotOperator newOperator = resolver.resolveConflict( operator, oldOperator );
     
      // Keep the good bot operator
      remove( oldOperator );
      if ( newOperator != null ) {
        synchronized ( map ) {
          map.put( newOperator.getOperatorName(), newOperator );
        }
      }
    }
   
    return !alreadyIn;
View Full Code Here


    if ( resolver == null ) { throw new NullPointerException(); }
   
    // Iterate through one container and add everything to the other
    synchronized ( container ) {
      for ( Iterator iter = container.iterator() ; iter.hasNext() ; ) {
        BotOperator operator = (BotOperator)iter.next();
        add( operator );
      }
    }
  }
View Full Code Here

    if ( hmbo.size() != this.size() ) { return false; }
   
    synchronized ( hmbo ) {
      // Checks if every bot operator is the same in the 2 containers
      for ( Iterator iter = hmbo.iterator() ; iter.hasNext() ; ) {
        BotOperator bo = (BotOperator)iter.next();
        BotOperator co = this.get( bo );
     
        if ( !bo.equals( co ) ) { return false; }
      }
    }
   
View Full Code Here

   * @return The bot operator if remove successfully, null otherwise.
   */
  public BotOperator remove ( BotOperator operator ) {
    if ( operator == null ) { throw new NullPointerException(); }
   
    BotOperator retval = null;
    synchronized ( map ) {
      retval = (BotOperator)map.remove( operator.getOperatorName() );
    }
    return retval;
  }
View Full Code Here

    if ( isEmpty() || container.isEmpty() ) { return; }
   
    // Iterate through one container and remove everything to the other
    synchronized ( container ) {
      for ( Iterator iter = container.iterator() ; iter.hasNext() ; ) {
        BotOperator operator = (BotOperator)iter.next();
        remove( operator );
      }
    }
  }
View Full Code Here

   
    // Iterate through one container and check if the other
    // has the bot operator has well.
    synchronized ( container ) {
      for ( Iterator iter = container.iterator() ; iter.hasNext() ; ) {
        BotOperator operator = (BotOperator)iter.next();
        BotOperator oldOperator = get( operator );
     
        // Checks if the bot operator was in both container
        if ( oldOperator != null ) {
          // The operator is in both container
          BotOperator keep = resolver.resolveConflict( operator, oldOperator );
       
          if ( keep != null ) {
            // Add the operator
            map.put( keep.getOperatorName(), keep );
          }
        }
      }
    }
 
View Full Code Here

     * @param newOperator The first operator.
     * @param oldOperator The second operator.
     * @return The operator with the highest access level.
     */
    public BotOperator resolveConflict ( BotOperator newOperator, BotOperator oldOperator ) {
      BotOperator retval = oldOperator;
     
      // Keep the highest access level
      if ( newOperator.getAccessLevel() > oldOperator.getAccessLevel() ) {
        retval = newOperator;
      }
View Full Code Here

          // There is a bot operator name
          line = line.trim();
         
          if ( line.length() > 0 ) {
            // Create and add the bot operator to the container
            BotOperator op = new BotOperator( line, this.accessLevel );
            set.add( op );
          }
        }
       
        line = rd.readLine();
View Full Code Here

   */
  public boolean checkAccess ( String playerName ) {
    boolean hasAccess = false;
   
    // Check if the player has SysOp access
    BotOperator operator = new BotOperator( playerName );
    if ( this.objBotOperators.contains( operator ) ) {
      // The operator is register... let check his access level
      operator = this.objBotOperators.get( operator );
     
      // This isn't suppose to happen often, but still...
      if ( operator != null ) {
        hasAccess = operator.getAccessLevel() >= AccessLevel.SYSOP;
      }
    }
   
    return hasAccess;
  }
View Full Code Here

TOP

Related Classes of wzhybridbots.security.BotOperator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.