added tab completion for bau toggle commands
Dieser Commit ist enthalten in:
Ursprung
00563e131a
Commit
1565fab35d
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
In neuem Issue referenzieren
Einen Benutzer sperren