SteamWar/BauSystem
Archiviert
13
0

added tab completion for bau toggle commands

Dieser Commit ist enthalten in:
Zeanon 2021-04-01 23:45:10 +02:00
Ursprung 00563e131a
Commit 1565fab35d

Datei anzeigen

@ -22,8 +22,13 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand;
import de.steamwar.command.SWCommandUtils;
import de.steamwar.command.TypeMapper;
import de.steamwar.comms.handlers.BungeeHandler;
import de.steamwar.sql.BauweltMember;
import de.steamwar.sql.SteamwarUser;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class CommandBau extends SWCommand {
@ -45,21 +50,21 @@ public class CommandBau extends SWCommand {
}
@Register("togglebuild")
public void toggleBuildCommand(Player p, String arg) {
public void toggleBuildCommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return;
onToggleBD(p, arg);
onToggleBD(p, arg.getName());
}
@Register("togglewe")
public void toggleWECommand(Player p, String arg) {
public void toggleWECommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return;
onToggleWE(p, arg);
onToggleWE(p, arg.getName());
}
@Register("toggleworld")
public void toggleWorldCommand(Player p, String arg) {
public void toggleWorldCommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return;
onToggleWorld(p, arg);
onToggleWorld(p, arg.getName());
}
@ -116,4 +121,25 @@ public class CommandBau extends SWCommand {
return true;
}
}
@ClassMapper(value = LocalPlayer.class, local = true)
private TypeMapper<LocalPlayer> mapCommandConfirmation() {
return SWCommandUtils.createMapper(LocalPlayer::new,
s -> Bukkit.getOnlinePlayers().stream().map(Player::getName).collect(Collectors.toList()));
}
public class LocalPlayer {
private String name;
public LocalPlayer(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
}