2011-10-19 00:37:00 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
|
|
|
|
|
|
|
import java.util.Random;
|
2012-11-13 01:42:30 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
|
2011-10-19 00:37:00 +00:00
|
|
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
|
|
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
|
|
|
public class Command_cake extends TFM_Command
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
|
|
{
|
2012-11-13 01:42:30 +00:00
|
|
|
if (senderIsConsole || TFM_SuperadminList.isUserSuperadmin(sender))
|
2011-10-19 00:37:00 +00:00
|
|
|
{
|
|
|
|
StringBuilder output = new StringBuilder();
|
|
|
|
Random randomGenerator = new Random();
|
|
|
|
|
|
|
|
for (String word : TotalFreedomMod.CAKE_LYRICS.split(" "))
|
|
|
|
{
|
|
|
|
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
|
|
|
|
output.append("§").append(color_code).append(word).append(" ");
|
|
|
|
}
|
|
|
|
|
2012-03-06 19:25:22 +00:00
|
|
|
for (Player p : server.getOnlinePlayers())
|
2011-10-19 00:37:00 +00:00
|
|
|
{
|
|
|
|
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
|
|
|
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
|
|
|
}
|
|
|
|
|
2011-10-24 02:43:52 +00:00
|
|
|
TFM_Util.bcastMsg(output.toString());
|
2011-10-19 00:37:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|