fixed command throwing error, added more messaging
This commit is contained in:
parent
09afec220a
commit
dc0b46f8f9
@ -4,5 +4,4 @@ version: 0.1
|
||||
api-version: 1.13
|
||||
commands:
|
||||
tw:
|
||||
description: "controlls plugin"
|
||||
usage: /jobs <list, info, stats, join, leave>
|
||||
description: "controlls plugin"
|
@ -17,7 +17,7 @@ public class Tridentwar extends JavaPlugin {
|
||||
getServer().getPluginManager().registerEvents(new ProjectileLaunchListener(this.gameManager, this), this);
|
||||
getServer().getPluginManager().registerEvents(new ProjectileHitListener(this.gameManager), this);
|
||||
getServer().getPluginManager().registerEvents(new PlayerDeathListener(this.gameManager), this);
|
||||
getCommand("tw").setExecutor(new TridentwarCommand(gameManager));
|
||||
getCommand("tw").setExecutor(new TridentwarCommand(this.gameManager));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -15,12 +15,19 @@ public class TridentwarCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
|
||||
if (args[0] == null) return false;
|
||||
|
||||
switch (args[0].toLowerCase()){
|
||||
case "start":
|
||||
gameManager.setGameState(GameState.STARTING);
|
||||
break;
|
||||
if(args.length >= 1) {
|
||||
switch (args[0].toLowerCase()){
|
||||
default:
|
||||
commandSender.sendMessage("use args: start");
|
||||
break;
|
||||
case "start":
|
||||
System.out.println(args[0]);
|
||||
gameManager.setGameState(GameState.STARTING);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
commandSender.sendMessage("Empty Commands are not allowed!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ public class GameManager {
|
||||
this.playerManager.giveKits();
|
||||
break;
|
||||
case STARTING:
|
||||
if(Bukkit.getOnlinePlayers().size() < 2) return; // TODO: Message about minimal player count not beeing reached
|
||||
if(Bukkit.getOnlinePlayers().size() < 2) {
|
||||
// Message about minimal player count not beeing reached
|
||||
Bukkit.broadcastMessage("Game cannot be started with a single player");
|
||||
return;
|
||||
}
|
||||
Bukkit.broadcastMessage("Starting!");
|
||||
this.gameStartCountdownTask = new GameStartCountdownTask(this);
|
||||
this.gameStartCountdownTask.runTaskTimer(plugin, 0 , 20);
|
||||
|
Loading…
x
Reference in New Issue
Block a user