コード例 #1
0
  @Override
  public boolean process(Client client, List<String> args) throws CommandProcessingException {
    boolean checksOk = super.process(client, args);
    if (!checksOk) {
      return false;
    }

    String dataFileName = Misc.makeSentence(args, 0);

    IP2Country service = getContext().getService(IP2Country.class);
    if (service == null) {
      client.sendLine("SERVERMSG IP2Country service not available!");
    } else {
      service.setDataFile(new File(dataFileName));
      if (service.initializeAll()) {
        client.sendLine("SERVERMSG IP2Country database initialized successfully!");
      } else {
        client.sendLine("SERVERMSG Error while initializing IP2Country database!");
      }
    }

    return true;
  }
コード例 #2
0
  @Override
  public boolean process(Client client, List<String> args) throws CommandProcessingException {
    boolean checksOk = super.process(client, args);
    if (!checksOk) {
      return false;
    }

    String username = args.get(0);
    String message = Misc.makeSentence(args, 1);

    Client targetClient = getContext().getClients().getClient(username);
    if (targetClient == null) {
      return false;
    }

    targetClient.sendLine(message);

    return true;
  }