Chroma-Chat/src/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;
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 ----",
"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;
2016-07-16 21:55:36 +00:00
ChatPlayer p = ChatPlayer.GetFromPlayer(player);
2016-06-22 23:38:35 +00:00
if (p.FlairState.equals(FlairStates.Accepted)) {
player.sendMessage("§cYou can only ignore the \"write yoőu rname in the thread\" message.");
return true;
}
if (p.FlairState.equals(FlairStates.Commented)) {
player.sendMessage("Sorry, but your flair isn't recorded. Please ask a mod to set it for you.");
return true;
}
if (!p.FlairState.equals(FlairStates.Ignored)) {
p.FlairState = FlairStates.Ignored;
2016-07-16 21:55:36 +00:00
p.SetFlair(ChatPlayer.FlairTimeNone);
2016-06-22 23:38:35 +00:00
p.UserName = "";
player.sendMessage("§bYou have ignored the message. You can still use /u accept to get a flair.§r");
} 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";
}
}