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