feat: add heal command
This commit is contained in:
parent
5a63464cce
commit
bc338ed4cf
2 changed files with 14 additions and 3 deletions
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -80,7 +81,15 @@ public class VaroCommand implements CommandExecutor {
|
|||
} else {
|
||||
sender.sendMessage("§c§lFehler: §r§cBitte überprüfe deine Eingabe.");
|
||||
}
|
||||
|
||||
} else if (args.length == 2 && args[0].equals("heal")) {
|
||||
Player p = Bukkit.getPlayerExact(args[1]);
|
||||
if (p == null) {
|
||||
sender.sendMessage("§c§lFehler: §r§cDer Spieler ist nicht online.");
|
||||
return true;
|
||||
}
|
||||
p.setHealth(20.0d);
|
||||
p.setFoodLevel(20);
|
||||
p.setSaturation(5.0f);
|
||||
} else if (args.length == 1 && args[0].equals("addspawns")) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("§c§lFehler: §r§cDieses Kommando kann nur von einem Spieler ausgeführt werden.");
|
||||
|
@ -97,7 +106,7 @@ public class VaroCommand implements CommandExecutor {
|
|||
this.addSpawnsCounter.put(p.getUniqueId(), teamPlayerId);
|
||||
firstRun = true;
|
||||
}
|
||||
final JSONArray teams = this.plugin.getTeamManager().getTeams();
|
||||
final JSONArray teams = this.plugin.getTeamManager().getJSONTeams();
|
||||
final JSONObject team = (JSONObject) teams.get(teamPlayerId.team);
|
||||
final JSONArray players = (JSONArray) team.get("players");
|
||||
|
||||
|
@ -139,6 +148,7 @@ public class VaroCommand implements CommandExecutor {
|
|||
sender.sendMessage("\n§6========== §b§lCliffbreak.de VARO §r§6============\n ");
|
||||
sender.sendMessage("§a/varo ban [Spieler]: §rSpieler bannen");
|
||||
sender.sendMessage("§a/varo unban [Spieler]: §rSpieler wieder auf den Server lassen");
|
||||
sender.sendMessage("§a/varo heal [Spieler]: §rSpieler heilen und Hunger auffüllen");
|
||||
sender.sendMessage("§a/varo portal [enable/disable]: §rAktiviere/Deaktiviere die Portal-Erstellung");
|
||||
sender.sendMessage("§a/varo addspawns: §rStarte den Spawn-Erstellungs-Wizard");
|
||||
sender.sendMessage("\n§6==========================================");
|
||||
|
|
|
@ -25,6 +25,7 @@ public class VaroTabCompleter implements TabCompleter {
|
|||
if (args.length == 1) {
|
||||
list.add("unban");
|
||||
list.add("ban");
|
||||
list.add("heal");
|
||||
list.add("portal");
|
||||
list.add("addspawns");
|
||||
} else if (args.length == 2 && args[0].equals("unban")) {
|
||||
|
@ -32,7 +33,7 @@ public class VaroTabCompleter implements TabCompleter {
|
|||
for (String uuid : bans) {
|
||||
list.add(this.plugin.getPlayerCache().getName(uuid));
|
||||
}
|
||||
} else if (args.length == 2 && args[0].equals("ban")) {
|
||||
} else if (args.length == 2 && (args[0].equals("ban") || args[0].equals("heal"))) {
|
||||
return null; // Return null to show default player autocomplete
|
||||
} else if (args.length == 2 && args[0].equals("portal")) {
|
||||
list.add("enable");
|
||||
|
|
Loading…
Reference in a new issue