port_to_commandframework #457
@ -21,18 +21,13 @@ package de.steamwar.bungeecore.commands;
|
||||
|
||||
import de.steamwar.bungeecore.*;
|
||||
import de.steamwar.bungeecore.sql.BauweltMember;
|
||||
import de.steamwar.command.PreviousArguments;
|
||||
import de.steamwar.command.SWCommand;
|
||||
import de.steamwar.command.TypeMapper;
|
||||
import de.steamwar.command.TypeValidator;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class JoinmeCommand extends SWCommand {
|
||||
|
||||
public JoinmeCommand() {
|
||||
@ -87,26 +82,13 @@ public class JoinmeCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@ClassMapper(ProxiedPlayer.class)
|
||||
public TypeMapper<ProxiedPlayer> playerMapper() {
|
||||
return new TypeMapper<ProxiedPlayer>() {
|
||||
@Override
|
||||
public ProxiedPlayer map(CommandSender commandSender, String[] previousArguments, String s) {
|
||||
return ProxyServer.getInstance().getPlayer(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate(CommandSender sender, ProxiedPlayer value, MessageSender messageSender) {
|
||||
if (value == null || !value.isConnected()) {
|
||||
messageSender.send("JOINME_PLAYER_OFFLINE", sender);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> tabCompletes(CommandSender sender, PreviousArguments previousArguments, String s) {
|
||||
return ProxyServer.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList());
|
||||
public TypeValidator<ProxiedPlayer> playerMapper() {
|
||||
return (sender, value, messageSender) -> {
|
||||
if (value == null || !value.isConnected()) {
|
||||
messageSender.send("JOINME_PLAYER_OFFLINE", sender);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class TeamCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "create", description = "TEAM_CREATE_USAGE")
|
||||
public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGHT") String name){
|
||||
public void create(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGTH") String kuerzel, @Length(min = 4, max = 15) @ErrorMessage("TEAM_NAME_LENGTH") String name){
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
Team team = Team.get(user.getTeam());
|
||||
if(unwantedInTeam(player, user))
|
||||
@ -299,7 +299,7 @@ public class TeamCommand extends SWCommand {
|
||||
}
|
||||
|
||||
@Register(value = "changekurzel", description = "TEAM_KUERZEL_USAGE")
|
||||
public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGHT") String kuerzel){
|
||||
public void changekuerzel(ProxiedPlayer player, @Length(min = 2, max = 4) @ErrorMessage("TEAM_KUERZEL_LENGTH") String kuerzel){
|
||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
||||
Team team = Team.get(user.getTeam());
|
||||
if(notLeader(player, user))
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren