package net.silentchaos512.gems.lib;

import java.util.List;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.silentchaos512.gems.SilentGems;
import net.silentchaos512.lib.util.PlayerHelper;

public class Greetings {

  public static final String PREFIX = "misc.silentgems:alpha";

  public static void greetPlayer(EntityPlayer player) {

    // Reset the random object, because it seems to yield the same value each time. Huh?
    SilentGems.instance.random.setSeed(System.currentTimeMillis());

    List<String> list = SilentGems.instance.localizationHelper.getDescriptionLines(PREFIX);
    String msg = SilentGems.instance.localizationHelper.getLocalizedString(PREFIX + "Prefix") + " ";
    int index = SilentGems.instance.random.nextInt(list.size());
    // SilentGems.instance.logHelper.debug(list.size(), index);
    msg += list.get(index);
    PlayerHelper.addChatMessage(player, TextFormatting.RED + msg);

    // TODO: Remove this later.
    PlayerHelper.addChatMessage(player,
        "Yes, the numbers in the upper-left are my fault. I'm working on it.");
  }
}

@@ -693,16 +693,45 @@
 REFIX);%0A
+    if (list.size() %3E 0) %7B%0A  
     Stri
@@ -815,16 +815,26 @@
 Prefix%22)
+%0A         
  + %22 %22;%0A
@@ -837,16 +837,18 @@
  %22;%0A    
+ 
+ 
 int inde
@@ -904,16 +904,18 @@
 ));%0A    
+  
 // Silen
@@ -970,16 +970,18 @@
 x);%0A    
+ 
+ 
 msg += l
@@ -992,24 +992,26 @@
 get(index);%0A
+  
     PlayerHe
@@ -1064,16 +1064,22 @@
  + msg);
+%0A    %7D
 %0A%0A    //
@@ -1144,16 +1144,16 @@
 player,%0A
-
         
@@ -1153,16 +1153,32 @@
        %22
+%5BSilent's Gems%5D 
 Yes, the

Fix greetings kicking players from servers