Implement /ready and basic objective mechanics
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package gg.malloc.defense.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import gg.malloc.defense.engine.GameRunner;
|
||||
|
||||
import gg.malloc.defense.Plugin;
|
||||
|
||||
public class PlayerReadyCommand implements CommandExecutor {
|
||||
Plugin m_plugin;
|
||||
|
||||
public PlayerReadyCommand(Plugin plugin) {
|
||||
m_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player)sender;
|
||||
GameRunner runner = m_plugin.getRunnerForWorld(player.getLocation().getWorld());
|
||||
runner.addPlayer(player);
|
||||
runner.togglePlayerReady(player);
|
||||
return true;
|
||||
} else {
|
||||
sender.sendMessage("You must be a player to use this command.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user