2016-09-08 14:23:44 +00:00
|
|
|
package buttondevteam.chat.commands.ucmds;
|
2016-06-23 10:42:22 +00:00
|
|
|
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2016-09-08 14:23:44 +00:00
|
|
|
import buttondevteam.chat.ChatFormatter;
|
|
|
|
import buttondevteam.chat.ChatPlayer;
|
|
|
|
import buttondevteam.chat.PluginMain;
|
2016-07-04 22:29:12 +00:00
|
|
|
|
2016-06-23 10:42:22 +00:00
|
|
|
public class CCommand extends UCommandBase {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public String[] GetHelpText(String alias) {
|
2016-07-17 00:26:53 +00:00
|
|
|
return new String[] { "§6---- Rainbow mode ----", "This command allows you to talk in rainbow colors",
|
2016-06-23 10:42:22 +00:00
|
|
|
"You need to be a donator or a mod to use this command" };
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-06-24 17:32:34 +00:00
|
|
|
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
|
2016-06-23 10:42:22 +00:00
|
|
|
Player player = (Player) sender;
|
2016-07-17 00:26:53 +00:00
|
|
|
ChatPlayer p = ChatPlayer.GetFromPlayer(player);
|
2016-06-23 10:42:22 +00:00
|
|
|
if (args.length < 1) {
|
|
|
|
if (PluginMain.permission.has(player, "tbmc.rainbow")) {
|
|
|
|
p.RainbowPresserColorMode = !p.RainbowPresserColorMode;
|
2016-06-27 17:56:12 +00:00
|
|
|
p.OtherColorMode = null;
|
2016-06-23 10:42:22 +00:00
|
|
|
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;
|
2016-06-27 17:56:12 +00:00
|
|
|
p.OtherColorMode = null;
|
2016-06-25 19:05:00 +00:00
|
|
|
try {
|
2016-07-17 00:26:53 +00:00
|
|
|
p.OtherColorMode = ChatFormatter.Color.valueOf(args[0].toLowerCase());
|
2016-06-25 19:05:00 +00:00
|
|
|
} catch (Exception e) {
|
|
|
|
player.sendMessage("§cUnknown message color: " + args[0]);
|
|
|
|
player.sendMessage("§cUse color names, like blue, or dark_aqua");
|
|
|
|
}
|
2016-06-27 17:56:12 +00:00
|
|
|
if (p.OtherColorMode != null)
|
2016-07-17 00:26:53 +00:00
|
|
|
player.sendMessage(String.format("§eMessage color set to %s", p.OtherColorMode));
|
2016-06-23 10:42:22 +00:00
|
|
|
else
|
|
|
|
player.sendMessage("§eMessage color reset.");
|
|
|
|
} else {
|
|
|
|
player.sendMessage("§cYou don't have permission for this command.");
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-06-24 17:32:34 +00:00
|
|
|
public String GetUCommandPath() {
|
2016-06-23 10:42:22 +00:00
|
|
|
return "c";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|