示例#1
0
 public BasicWorld(
     MinecraftBot bot, WorldType type, Dimension dimension, Difficulty difficulty, int height) {
   this.bot = bot;
   this.type = type;
   this.height = height;
   this.dimension = dimension;
   this.difficulty = difficulty;
   chunks = new HashMap<ChunkLocation, Chunk>();
   entities = new ArrayList<Entity>();
   pathFinder = new AStarPathSearchProvider(this);
   EventManager eventManager = bot.getEventManager();
   eventManager.registerListener(this);
 }
示例#2
0
  /**
   * Execute a command. Do not forget to initialize the CVS Root on globalOptions first! Example:
   * <code>
   *   GlobalOptions options = new GlobalOptions();
   *   options.setCVSRoot(":pserver:"+userName+"@"+hostName+":"+cvsRoot);
   * </code>
   *
   * @param command the command to execute
   * @param options the global options to use for executing the command
   * @throws CommandException if an error occurs when executing the command
   * @throws CommandAbortedException if the command is aborted
   */
  public boolean executeCommand(Command command, GlobalOptions globalOptions)
      throws CommandException, CommandAbortedException, AuthenticationException {
    BugLog.getInstance().assertNotNull(command);
    BugLog.getInstance().assertNotNull(globalOptions);

    this.globalOptions = globalOptions;

    getUncompressedFileHandler().setGlobalOptions(globalOptions);
    getGzipFileHandler().setGlobalOptions(globalOptions);

    try {
      eventManager.addCVSListener(command);
      command.execute(this, eventManager);
    } finally {
      eventManager.removeCVSListener(command);
    }
    return !command.hasFailed();
  }
示例#3
0
 @Override
 public void destroy() {
   EventManager eventManager = bot.getEventManager();
   eventManager.unregisterListener(this);
 }