001/* 002 * PlotSquared, a land and world management plugin for Minecraft. 003 * Copyright (C) IntellectualSites <https://intellectualsites.com> 004 * Copyright (C) IntellectualSites team and contributors 005 * 006 * This program is free software: you can redistribute it and/or modify 007 * it under the terms of the GNU General Public License as published by 008 * the Free Software Foundation, either version 3 of the License, or 009 * (at your option) any later version. 010 * 011 * This program is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 014 * GNU General Public License for more details. 015 * 016 * You should have received a copy of the GNU General Public License 017 * along with this program. If not, see <https://www.gnu.org/licenses/>. 018 */ 019package com.plotsquared.core.configuration.caption; 020 021import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; 022 023/** 024 * A holder for a caption. 025 * Useful when constructing messages in multiple steps with {@link TagResolver}s. 026 */ 027public class CaptionHolder { 028 029 private Caption caption = StaticCaption.of(""); 030 private TagResolver[] tagResolvers = new TagResolver[0]; 031 032 /** 033 * Set the {@link Caption} to send. 034 * 035 * @param caption The new caption. 036 */ 037 public void set(Caption caption) { 038 this.caption = caption; 039 } 040 041 /** 042 * Get the {@link Caption} to send. 043 * 044 * @return The caption to send. 045 */ 046 public Caption get() { 047 return this.caption; 048 } 049 050 /** 051 * Get the {@link TagResolver}s to use when resolving tags in the {@link Caption}. 052 * 053 * @return The tag resolvers to use. 054 * @since 7.0.0 055 */ 056 public TagResolver[] getTagResolvers() { 057 return this.tagResolvers; 058 } 059 060 /** 061 * Set the {@link TagResolver}s to use when resolving tags in the {@link Caption}. 062 * 063 * @param tagResolvers The tag resolvers to use. 064 * @since 7.0.0 065 */ 066 public void setTagResolvers(TagResolver... tagResolvers) { 067 this.tagResolvers = tagResolvers; 068 } 069 070}