public PubSystem(IGameConfiguration configuration, IWorld world) { this.configuration = configuration; this.world = world; this.timer = new Timer(configuration.getPubInterval() * 60 * 1000, this); this.messages = CollectionUtils.toList(configuration.getPubMessages()); this.messageColor = this.configuration.getPubColor(); this.currentMessage = 0; }
@Override public void actionPerformed(ActionEvent e) { String message = StringUtils.format(PUB_MESSAGE_FORMAT, messageColor, messages.get(currentMessage)); world.systemMessage(new SystemMessageEvent(message)); ++currentMessage; if (currentMessage >= configuration.getPubMessages().length) { currentMessage = 0; } }