Skip to content

Commit

Permalink
Properly handle colors on old versions
Browse files Browse the repository at this point in the history
  • Loading branch information
foxfirecodes committed Jul 14, 2020
1 parent 440c1f0 commit 965e31c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/java/me/rayzr522/jsonmessage/JSONMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ public void actionbar(Player... players) {
public JSONMessage color(ChatColor color) {
if (!color.isColor())
throw new IllegalArgumentException(color.name() + " is not a color.");
return color(color.name().toLowerCase(), ChatColor.WHITE);

last().setColor(color);
return this;
}

/**
Expand Down Expand Up @@ -1014,6 +1016,15 @@ public ChatColor getColor() {
@Deprecated
public void setColor(ChatColor color) {
setColor(color == null ? null : color.name().toLowerCase());
setLegacyColor(color);
}

/**
* @param color The legacy ChatColor to set
* @deprecated Use {@link #setColor(String)} instead
*/
@Deprecated
public void setLegacyColor(ChatColor color) {
legacyColor = color;
}

Expand Down

0 comments on commit 965e31c

Please sign in to comment.