Adds support for dyed stargate signs
A dyed sign's color will now take priority over its main sign color. Black is used as the "default" color, so use black dye to remove dye effects Adds a new class to keep track of a sign and its colors Updates a bunch of code to make everything account for the dye color
This commit is contained in:
64
src/main/java/net/knarcraft/stargate/container/SignData.java
Normal file
64
src/main/java/net/knarcraft/stargate/container/SignData.java
Normal file
@ -0,0 +1,64 @@
|
||||
package net.knarcraft.stargate.container;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
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 <p>The sign the colors belong to</p>
|
||||
* @param mainSignColor <p>The main color to use for the sign</p>
|
||||
* @param highlightSignColor <p>The highlighting color to use for the sign</p>
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @return <p>The sign of this sign colors object</p>
|
||||
*/
|
||||
public Sign getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the main color of the sign
|
||||
*
|
||||
* @return <p>The main color of the sign</p>
|
||||
*/
|
||||
public ChatColor getMainSignColor() {
|
||||
if (dyedColor != DyeColor.BLACK) {
|
||||
Color color = dyedColor.getColor();
|
||||
return ChatColor.of(String.format("#%02X%02X%02X", color.getRed(), color.getGreen(), color.getBlue()));
|
||||
} else {
|
||||
return mainSignColor;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the highlighting color of the sign
|
||||
*
|
||||
* @return <p>The highlighting color of the sign</p>
|
||||
*/
|
||||
public ChatColor getHighlightSignColor() {
|
||||
return highlightSignColor;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user