mkremins / fanciful

Fancy Bukkit message formatting
MIT License
95 stars 82 forks source link

Spigot 1.7.10 - \n cartridge return? #69

Closed CyberSecGuy closed 8 years ago

CyberSecGuy commented 8 years ago

Hi! I love Fanciful, and currently use it in a plugin of mine.

I'm using the following code to run a multi-lined reply, while keeping them all wrapped as 1 long line.

public FancyMessage linkNMS(Player player, String platform) {
    String line1 = ChatColor.STRIKETHROUGH + "                     " + ChatColor.RESET + " " + Main.Tag + ChatColor.RESET + " " + ChatColor.STRIKETHROUGH + "                     ";
    String line2 = "+ " + ChatColor.BLUE + "Update your URL using the command:";
    String line3 = "+ " + ChatColor.GREEN + "/yt " + ChatColor.RED + platform + ChatColor.GOLD + " <your link> " + ChatColor.AQUA + "[Click Me!]";
    String lb = "\n";
    String cmd = "";
    String tooltip = "";

    if (Main.Strummer.containsKey(player.getName())) {
        Streamer strum = Main.Strummer.get(player.getName());

        if (platform.equals("youtube")) {
            tooltip = "Current Link: " + strum.youtube;
            cmd = "/yt " + platform + " http://www.youtube.com/";
        }

        if (platform.equals("twitch")) {
            tooltip = "Current Link: " + strum.twitch;
            cmd = "/yt " + platform + " http://www.twitch.tv/";
        }

        if (platform.equals("twitter")) {
            tooltip = "Current Link: " + strum.twitter;
            cmd = "/yt " + platform + " http://www.twitter.com/";
        }
    }

    return new FancyMessage(line1).suggest(cmd).tooltip(tooltip).then(lb).then(line2).suggest(cmd).tooltip(tooltip).then(lb).then(line3).suggest(cmd).tooltip(tooltip);
}

and it works just fine.

CyberSecGuy commented 8 years ago

Whoops duplicate!