Exemple #1
0
  @Override
  public void startup() {
    frontEnd.addMailListener(
        new PlayerMailListener() {
          @Override
          public void notifyMail(Player who, Message m) {
            if (who.getAttr(Attribute.FORWARD_EMAIL).booleanValue()
                && (m.getType() == PlayerMessageType.MESSAGE)) {
              try {
                AuthService authService = frontEnd.findService(AuthService.class);
                String email = authService.getEmail(who.getPrimaryIdentity());
                if (email == null) {
                  logger.fine("Forwarding to email failed. " + who + " has no email adress.");
                  return;
                }
                logger.fine("Forwarding message for " + who + " to email " + email);

                Player sender = m.getSender(frontEnd.getGalaxy());
                String subject = m.getSubject(EMAIL_CONVERTER);
                String text = m.getText(EMAIL_CONVERTER);
                Email em = new Email(email);
                em.setSubject("[Conquer-Space.net] " + subject);
                em.setBody(
                    sender.getName() + " schreibt an " + who.getName() + ":\n\n" + text + "\n");
                frontEnd.findService(SmtpService.class).sendEmail(em);
              } catch (Exception e) {
                logger.log(Level.SEVERE, "Exception caught", e);
              }
            }
          }
        });
  }
Exemple #2
0
 public boolean hasNewAllianceMessage(Player p) {
   Alliance a = p.getAlliance();
   if (a == null) return false;
   AllianceData ad = AllianceData.getAllianceDataCopy(frontEnd.getStorageManager(), a.getId());
   return (p.getAllianceReadTime() <= ad.getMail().getFolder(0).getLastAddRealTime())
       && (ad.getMail().folderSize(0) > 0);
 }
Exemple #3
0
 public <T extends Service> T findService(Class<T> type) {
   return frontEnd.findService(type);
 }
Exemple #4
0
 public int countOnlinePlayers() {
   return frontEnd.online();
 }
Exemple #5
0
 public boolean isOnline(Player p) {
   return frontEnd.isOnline(p);
 }
Exemple #6
0
 public String getSupportEmail() {
   return frontEnd.getSupportEmail();
 }
Exemple #7
0
 public String getVersion() {
   return frontEnd.version();
 }
Exemple #8
0
 public boolean debug() {
   return frontEnd.debug();
 }
Exemple #9
0
 public ObserverReport getObserverReport(String id) {
   return ObserverReport.getObserverReportCopy(frontEnd.getStorageManager(), id);
 }
Exemple #10
0
 public String getUrl() {
   return frontEnd.url();
 }
Exemple #11
0
 public AgentReport getAgentReport(String id) {
   return AgentReport.getAgentReportCopy(frontEnd.getStorageManager(), id);
 }
Exemple #12
0
 public BattleReport getBattleReport(String id) {
   return BattleReport.getBattleReportCopy(frontEnd.getStorageManager(), id);
 }
Exemple #13
0
 public MoneyData getMoneyReport(Player player) {
   return MoneyData.getMoneyDataCopy(frontEnd.getStorageManager(), player.getPid());
 }
Exemple #14
0
 public List<Locale> getSupportedLocales() {
   return frontEnd.getLocaleProvider().getAvailableLocales();
 }
Exemple #15
0
 public long getRandomLong() {
   return frontEnd.getGalaxy().getRandomLong();
 }