Chroma-Chat/src/io/github/norbipeti/thebuttonmcchat/commands/ucmds/CCommand.java

58 lines
1.8 KiB
Java
Raw Normal View History

2016-06-23 10:42:22 +00:00
package io.github.norbipeti.thebuttonmcchat.commands.ucmds;
import io.github.norbipeti.thebuttonmcchat.MaybeOfflinePlayer;
import io.github.norbipeti.thebuttonmcchat.PluginMain;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CCommand extends UCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- Rainbow mode ----",
"This command allows you to talk in rainbow colors",
"You need to be a donator or a mod to use this command" };
}
@Override
public boolean OnUCommand(CommandSender sender, String alias, String[] args) {
Player player = (Player) sender;
MaybeOfflinePlayer p = MaybeOfflinePlayer.AddPlayerIfNeeded(player
.getUniqueId());
if (args.length < 1) {
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
p.OtherColorMode = "";
if (p.RainbowPresserColorMode)
player.sendMessage("§eRainbow colors §aenabled.");
else
player.sendMessage("§eRainbow colors §cdisabled.");
} else {
player.sendMessage("§cYou don't have permission for this command. Donate to get it!");
return true;
}
} else {
if (PluginMain.permission.has(player, "tbmc.admin")) {
p.RainbowPresserColorMode = false;
p.OtherColorMode = args[0];
if (p.OtherColorMode.length() > 0)
player.sendMessage(String.format(
"§eMessage color set to %s", p.OtherColorMode));
else
player.sendMessage("§eMessage color reset.");
} else {
player.sendMessage("§cYou don't have permission for this command.");
return true;
}
}
return true;
}
@Override
public String GetUCommandName() {
return "c";
}
}