private void target(Info info) { if (raidTarget.containsKey(info.getChannel())) { info.sendMessage( COLOR + "The raid target is " + raidTarget.get(info.getChannel()) + " located at " + raidLocation.get(info.getChannel())); } else info.sendMessage("No target is set."); }
private void setTarget(Info info) { String factionInfo = info.getMessage().substring(11); String[] splitInfo = factionInfo.split("/"); if (splitInfo.length != 2) { info.sendMessage("usage for !setTarget is !setTarget <faction>/<location>"); } else { raidTarget.put(info.getChannel(), splitInfo[0]); raidLocation.put(info.getChannel(), splitInfo[1]); target(info); } }
private void go(Info info) { String msg = COLOR + Colors.BOLD + "MOVE OUT!"; if (raidTarget.get(info.getChannel()) != null) { msg += Colors.NORMAL + COLOR + " Target is " + raidTarget.get(info.getChannel()) + " " + raidLocation.get(info.getChannel()); } info.sendMessage(msg); }
/** Sets the time of the next scheduled raid */ private void setNextRaid(Info info) { String raidTime = info.getMessage().substring(13); raidTime = substituteTimeZone(raidTime); try { SimpleDateFormat parser = new SimpleDateFormat("yyyy-MM-dd HH:mm z"); Date date = parser.parse(raidTime); TimeZone z = parser.getTimeZone(); GregorianCalendar cal = new GregorianCalendar(z); cal.setTime(date); raids.put(info.getChannel(), cal); saveRaids(); info.sendMessage("Raid time set."); } catch (ParseException e) { info.sendMessage( "Date format was bad. Date format is like \"2008-11-26 21:45 EST\". You entered " + raidTime); } }
private void nextRaid(Info info) { GregorianCalendar nextRaid = raids.get(info.getChannel()); GregorianCalendar now = Utils.getRealDate(info); int diffMins = (int) ((nextRaid.getTimeInMillis() - now.getTimeInMillis()) / 1000 / 60); if (nextRaid.compareTo(now) < 0) { info.sendMessage("There is no future raid set."); return; } String tz = info.getMessage().substring(9).trim(); tz = substituteTimeZone(tz); TimeZone timeZone; if (tz.length() == 0) timeZone = tZF("GMT"); else timeZone = tZF(tz); formatter.setTimeZone(timeZone); String ret = "The next raid is scheduled for " + formatter.format(nextRaid.getTime()); ret = ret + getTimeDifference(diffMins); info.sendMessage(ret); }
private void clearStats(Info info) { raidTarget.remove(info.getChannel()); raidLocation.remove(info.getChannel()); raidPath.remove(info.getChannel()); info.sendMessage("Raid status cleared."); }
private void path(Info info) { if (raidPath.containsKey(info.getChannel())) { info.sendMessage(COLOR + raidPath.get(info.getChannel())); } else info.sendMessage("No path to the target is set."); }
private void setPath(Info info) { String path = info.getMessage().substring(8); raidPath.put(info.getChannel(), path); info.sendMessage("The path to the target is set."); }