Added /tagnyan. Resolves #170

This commit is contained in:
unknown 2014-05-05 16:03:15 +02:00
parent 742450d016
commit 9bc0859fdf
2 changed files with 39 additions and 2 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Mon May 05 15:29:34 CEST 2014 #Mon May 05 16:00:01 CEST 2014
build.number=821 build.number=822

View File

@ -0,0 +1,37 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import net.minecraft.util.org.apache.commons.lang3.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Gives you a tag with random colors", usage = "/<command> <tag>", aliases = "tn")
public class Command_tagnyan extends TFM_Command
{
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
final StringBuilder tag = new StringBuilder();
for (char c : ChatColor.stripColor(TFM_Util.colorize(StringUtils.join(args, " "))).toCharArray())
{
tag.append(TFM_Util.randomChatColor()).append(c);
}
final TFM_PlayerData data = TFM_PlayerData.getPlayerData(sender_p);
data.setTag(tag.toString());
playerMsg("Set tag to " + tag);
return true;
}
}