SteamWar/BauSystem
Archiviert
13
0

Update BauSystem to new CommandFramework #217

Manuell gemergt
YoyoNow hat 63 Commits von CommandFramework nach master 2021-04-02 18:08:26 +02:00 zusammengeführt
Nur Änderungen aus Commit 1565fab35d werden angezeigt - Alle Commits anzeigen

Datei anzeigen

@ -22,8 +22,13 @@ package de.steamwar.bausystem.commands;
import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.BauSystem;
import de.steamwar.bausystem.world.Welt; import de.steamwar.bausystem.world.Welt;
import de.steamwar.command.SWCommand; 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.BauweltMember;
import de.steamwar.sql.SteamwarUser; import de.steamwar.sql.SteamwarUser;
import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class CommandBau extends SWCommand { public class CommandBau extends SWCommand {
@ -45,21 +50,21 @@ public class CommandBau extends SWCommand {
} }
@Register("togglebuild") @Register("togglebuild")
public void toggleBuildCommand(Player p, String arg) { public void toggleBuildCommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
onToggleBD(p, arg); onToggleBD(p, arg.getName());
} }
@Register("togglewe") @Register("togglewe")
public void toggleWECommand(Player p, String arg) { public void toggleWECommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
onToggleWE(p, arg); onToggleWE(p, arg.getName());
} }
@Register("toggleworld") @Register("toggleworld")
public void toggleWorldCommand(Player p, String arg) { public void toggleWorldCommand(Player p, LocalPlayer arg) {
if (!permissionCheck(p)) return; if (!permissionCheck(p)) return;
onToggleWorld(p, arg); onToggleWorld(p, arg.getName());
} }
@ -116,4 +121,25 @@ public class CommandBau extends SWCommand {
return true; 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;
}
}
} }