mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-19 05:45:01 +00:00
/cookie returns (#65)
This commit is contained in:
parent
f7f6c47a1a
commit
bdae2b7b54
@ -0,0 +1,37 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||||
|
public class Command_cookie extends FreedomCommand
|
||||||
|
{
|
||||||
|
public static final String COOKIE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cookies.";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
final StringBuilder output = new StringBuilder();
|
||||||
|
|
||||||
|
for (final String word : COOKIE_LYRICS.split(" ")) {
|
||||||
|
output.append(FUtil.randomChatColor()).append(word).append(" ");
|
||||||
|
}
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
|
||||||
|
for (final Player player : this.server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
final int firstEmpty = player.getInventory().firstEmpty();
|
||||||
|
if (firstEmpty >= 0) {
|
||||||
|
player.getInventory().setItem(firstEmpty, heldItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FUtil.bcastMsg(output.toString());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user