mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-10-31 23:19:20 +00:00
Added /tagnyan. Resolves #170
This commit is contained in:
parent
742450d016
commit
9bc0859fdf
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Mon May 05 15:29:34 CEST 2014
|
||||
build.number=821
|
||||
#Mon May 05 16:00:01 CEST 2014
|
||||
build.number=822
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue