Chroma-Chat/src/main/java/buttondevteam/chat/commands/ucmds/IgnoreCommand.java

47 lines
1.5 KiB
Java
Raw Normal View History

2016-09-08 14:23:44 +00:00
package buttondevteam.chat.commands.ucmds;
2016-06-22 23:38:35 +00:00
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2016-09-08 14:23:44 +00:00
import buttondevteam.chat.ChatPlayer;
import buttondevteam.chat.FlairStates;
import buttondevteam.lib.TBMCPlayer;
2016-07-04 22:29:12 +00:00
2016-06-22 23:38:35 +00:00
public final class IgnoreCommand extends UCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[] { "§6---- Ignore flair ----",
2016-06-22 23:38:35 +00:00
"Stop the \"write your name in the thread\" message from showing up",
"Use /u ignore <username> if you commented from multiple accounts" };
}
@Override
2016-06-24 17:32:34 +00:00
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
2016-06-22 23:38:35 +00:00
final Player player = (Player) sender;
ChatPlayer p = TBMCPlayer.getPlayerAs(player, ChatPlayer.class);
if (p.getFlairState().equals(FlairStates.Accepted)) {
2016-10-26 20:35:28 +00:00
player.sendMessage("§cYou can only ignore the \"write your name in the thread\" message.");
2016-06-22 23:38:35 +00:00
return true;
}
if (p.getFlairState().equals(FlairStates.Commented)) {
2016-06-22 23:38:35 +00:00
player.sendMessage("Sorry, but your flair isn't recorded. Please ask a mod to set it for you.");
return true;
}
if (!p.getFlairState().equals(FlairStates.Ignored)) {
p.setFlairState(FlairStates.Ignored);
2016-07-16 21:55:36 +00:00
p.SetFlair(ChatPlayer.FlairTimeNone);
p.setUserName("");
player.sendMessage("§bYou have ignored the message.§r");
2016-06-22 23:38:35 +00:00
} else
player.sendMessage("§cYou already ignored the message.§r");
return true;
}
@Override
2016-06-24 17:32:34 +00:00
public String GetUCommandPath() {
2016-06-22 23:38:35 +00:00
return "ignore";
}
}