package net.knarcraft.stargate.container; import net.knarcraft.stargate.utility.ColorHelper; import net.md_5.bungee.api.ChatColor; import org.bukkit.DyeColor; import org.bukkit.block.Sign; /** * A class that keeps track of the sign colors for a given sign */ public class SignData { private final Sign sign; private final ChatColor mainSignColor; private final ChatColor highlightSignColor; private final DyeColor dyedColor; /** * Instantiates a new sign colors object * * @param sign
The sign the colors belong to
* @param mainSignColorThe main color to use for the sign
* @param highlightSignColorThe highlighting color to use for the sign
*/ public SignData(Sign sign, ChatColor mainSignColor, ChatColor highlightSignColor) { this.sign = sign; this.mainSignColor = mainSignColor; this.highlightSignColor = highlightSignColor; this.dyedColor = sign.getColor(); } /** * Gets the sign of this sign colors object * * @returnThe sign of this sign colors object
*/ public Sign getSign() { return sign; } /** * Gets the main color of the sign * * @returnThe main color of the sign
*/ public ChatColor getMainSignColor() { if (dyedColor != DyeColor.BLACK) { return ColorHelper.fromColor(dyedColor.getColor()); } else { return mainSignColor; } } /** * Gets the highlighting color of the sign * * @returnThe highlighting color of the sign
*/ public ChatColor getHighlightSignColor() { if (dyedColor != DyeColor.BLACK) { return ColorHelper.fromColor(ColorHelper.invert(dyedColor.getColor())); } else { return highlightSignColor; } } }