Esempio n. 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);
              }
            }
          }
        });
  }
Esempio n. 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);
 }
Esempio n. 3
0
 public <T extends Service> T findService(Class<T> type) {
   return frontEnd.findService(type);
 }
Esempio n. 4
0
 public int countOnlinePlayers() {
   return frontEnd.online();
 }
Esempio n. 5
0
 public boolean isOnline(Player p) {
   return frontEnd.isOnline(p);
 }
Esempio n. 6
0
 public String getSupportEmail() {
   return frontEnd.getSupportEmail();
 }
Esempio n. 7
0
 public String getVersion() {
   return frontEnd.version();
 }
Esempio n. 8
0
 public boolean debug() {
   return frontEnd.debug();
 }
Esempio n. 9
0
 public ObserverReport getObserverReport(String id) {
   return ObserverReport.getObserverReportCopy(frontEnd.getStorageManager(), id);
 }
Esempio n. 10
0
 public String getUrl() {
   return frontEnd.url();
 }
Esempio n. 11
0
 public AgentReport getAgentReport(String id) {
   return AgentReport.getAgentReportCopy(frontEnd.getStorageManager(), id);
 }
Esempio n. 12
0
 public BattleReport getBattleReport(String id) {
   return BattleReport.getBattleReportCopy(frontEnd.getStorageManager(), id);
 }
Esempio n. 13
0
 public MoneyData getMoneyReport(Player player) {
   return MoneyData.getMoneyDataCopy(frontEnd.getStorageManager(), player.getPid());
 }
Esempio n. 14
0
 public List<Locale> getSupportedLocales() {
   return frontEnd.getLocaleProvider().getAvailableLocales();
 }
Esempio n. 15
0
 public long getRandomLong() {
   return frontEnd.getGalaxy().getRandomLong();
 }