package in.twizmwaz.cardinal.command;

import com.sk89q.minecraft.util.commands.Command;
import com.sk89q.minecraft.util.commands.CommandContext;
import com.sk89q.minecraft.util.commands.CommandException;
import in.twizmwaz.cardinal.Cardinal;
import in.twizmwaz.cardinal.chat.ChatConstant;
import in.twizmwaz.cardinal.chat.LocalizedChatMessage;
import in.twizmwaz.cardinal.chat.UnlocalizedChatMessage;
import in.twizmwaz.cardinal.util.ChatUtil;
import in.twizmwaz.cardinal.util.Players;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;

public class SnowflakesCommand {

    @Command(aliases = {"snowflakes"}, desc = "View your own or another player's snowflake count.", usage = "[player]")
    public static void settings(final CommandContext cmd, CommandSender sender) throws CommandException {
        if (cmd.argsLength() == 0) {
            Bukkit.dispatchCommand(sender, "snowflakes " + sender.getName());
        } else {
            OfflinePlayer player = Bukkit.getOfflinePlayer(cmd.getString(0));
            if (sender.equals(player)) {
                sender.sendMessage(new UnlocalizedChatMessage(ChatColor.DARK_PURPLE + "{0} " + ChatColor.GOLD + "{1} {2}", ChatConstant.MISC_YOU_HAVE.asMessage(), new UnlocalizedChatMessage("{0}", Cardinal.getCardinalDatabase().get(player, "snowflakes")), Cardinal.getCardinalDatabase().get(player, "snowflakes").equals("1") ? ChatConstant.SNOWFLAKES_SNOWFLAKE.asMessage() : ChatConstant.SNOWFLAKES_SNOWFLAKES.asMessage()).getMessage(ChatUtil.getLocale(sender)));
            } else {
                sender.sendMessage(new UnlocalizedChatMessage(ChatColor.DARK_PURPLE + "{0} " + ChatColor.GOLD + "{1} {2}", new LocalizedChatMessage(ChatConstant.MISC_HAS, Players.getName(player) + ChatColor.DARK_PURPLE), new UnlocalizedChatMessage("{0}", Cardinal.getCardinalDatabase().get(player, "snowflakes")), Cardinal.getCardinalDatabase().get(player, "snowflakes").equals("1") ? ChatConstant.SNOWFLAKES_SNOWFLAKE.asMessage() : ChatConstant.SNOWFLAKES_SNOWFLAKES.asMessage()).getMessage(ChatUtil.getLocale(sender)));
            }
        }
    }

}

@@ -1076,24 +1076,171 @@
 String(0));%0A
+            String snowflakes = Cardinal.getCardinalDatabase().get(player, %22snowflakes%22);%0A            if (snowflakes.equals(%22%22)) snowflakes = %220%22;%0A
             
@@ -1469,52 +1469,8 @@
 %7D%22, 
-Cardinal.getCardinalDatabase().get(player, %22
 snow
@@ -1479,57 +1479,11 @@
 akes
-%22)
 ), 
-Cardinal.getCardinalDatabase().get(player, %22
 snow
@@ -1480,34 +1480,32 @@
 kes), snowflakes
-%22)
 .equals(%221%22) ? C
@@ -1920,52 +1920,8 @@
 %7D%22, 
-Cardinal.getCardinalDatabase().get(player, %22
 snow
@@ -1930,57 +1930,11 @@
 akes
-%22)
 ), 
-Cardinal.getCardinalDatabase().get(player, %22
 snow
@@ -1939,18 +1939,16 @@
 owflakes
-%22)
 .equals(

Fix empty count displayed on snowflakes command.