2016-07-04 22:29:12 +00:00
|
|
|
package buttondevteam.thebuttonmcchat.commands;
|
2016-06-22 23:38:35 +00:00
|
|
|
|
|
|
|
import org.bukkit.GameMode;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2016-07-04 22:29:12 +00:00
|
|
|
import buttondevteam.thebuttonmcchat.TBMCPlayer;
|
|
|
|
|
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-01 14:54:21 +00:00
|
|
|
TBMCPlayer p = TBMCPlayer.AllPlayers.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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|