/** * Builds an immutable instance of the current configuration. * * @return An immutable {@link Title} with the currently configured settings */ public Title build() { // If the title has no other properties and is either empty, just clears // or just resets we can return a special instance if (this.title == null && this.subtitle == null && this.fadeIn == null && this.stay == null && this.fadeOut == null) { if (this.clear) { if (!this.reset) { return Titles.clear(); } } else if (this.reset) { return Titles.reset(); } else { return Titles.of(); } } return new Title( this.title, this.subtitle, this.fadeIn, this.stay, this.fadeOut, this.clear, this.reset); }