Chroma-Chat/src/main/java/buttondevteam/chat/commands/ChatonlyCommand.java

48 lines
1.2 KiB
Java
Raw Normal View History

2016-09-08 14:23:44 +00:00
package buttondevteam.chat.commands;
2016-06-22 23:38:35 +00:00
import org.bukkit.GameMode;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
2016-09-08 14:23:44 +00:00
import buttondevteam.chat.ChatPlayer;
2016-07-04 22:29:12 +00:00
2016-06-22 23:38:35 +00:00
public final class ChatonlyCommand extends TBMCCommandBase {
@Override
public String[] GetHelpText(String alias) {
return new String[]{
"§6---- Chat-only mode ----",
"This mode makes you invincible but unable to move, teleport or interact with the world in any way",
"It was designed for chat clients",
"Once enabled, the only way of disabling it is by relogging to the server"
};
}
@Override
public boolean OnCommand(CommandSender sender, String alias, String[] args) {
Player player=(Player)sender;
2016-07-17 00:26:53 +00:00
ChatPlayer p = ChatPlayer.OnlinePlayers.get(player
2016-06-22 23:38:35 +00:00
.getUniqueId());
p.ChatOnly = true;
player.setGameMode(GameMode.SPECTATOR);
player.sendMessage("§bChat-only mode enabled. You are now invincible.");
return true;
}
@Override
2016-06-24 17:32:34 +00:00
public String GetCommandPath() {
2016-06-22 23:38:35 +00:00
return "chatonly";
}
@Override
public boolean GetPlayerOnly() {
return false;
}
2016-07-16 21:55:36 +00:00
@Override
public boolean GetModOnly() {
return false;
}
2016-06-22 23:38:35 +00:00
}