Dieser Commit ist enthalten in:
Ursprung
8a21d5c93d
Commit
21f020e13d
@ -23,32 +23,36 @@ import de.steamwar.bungeecore.ArenaMode;
|
|||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
import de.steamwar.bungeecore.sql.UserElo;
|
import de.steamwar.bungeecore.sql.UserElo;
|
||||||
|
import de.steamwar.command.SWCommand;
|
||||||
|
import de.steamwar.command.SWCommandUtils;
|
||||||
|
import de.steamwar.command.TypeMapper;
|
||||||
|
import net.md_5.bungee.BungeeCord;
|
||||||
import net.md_5.bungee.api.CommandSender;
|
import net.md_5.bungee.api.CommandSender;
|
||||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class RankCommand extends BasicCommand {
|
public class RankCommand extends SWCommand {
|
||||||
|
|
||||||
public RankCommand() {
|
public RankCommand() {
|
||||||
super("rank", null);
|
super("rank");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Register
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void ownRank(ProxiedPlayer player) {
|
||||||
if(!(sender instanceof ProxiedPlayer))
|
rank(player, player.getName());
|
||||||
return;
|
}
|
||||||
|
|
||||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
@Register
|
||||||
SteamwarUser user = SteamwarUser.get(player.getUniqueId());
|
public void rank(ProxiedPlayer player, @Mapper("player") String s) {
|
||||||
if (args.length > 0) {
|
SteamwarUser user = SteamwarUser.get(s);
|
||||||
SteamwarUser nUser = SteamwarUser.get(args[0]);
|
if (user == null) {
|
||||||
if (nUser == null) {
|
|
||||||
Message.send("RANK_PLAYER_NOT_FOUND", player);
|
Message.send("RANK_PLAYER_NOT_FOUND", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Message.send("RANK_PLAYER_FOUND", player, nUser.getUserName());
|
if (!player.getName().equals(s)) {
|
||||||
user = nUser;
|
Message.send("RANK_PLAYER_FOUND", player, user.getUserName());
|
||||||
}
|
}
|
||||||
for(ArenaMode mode : ArenaMode.getAllModes()) {
|
for(ArenaMode mode : ArenaMode.getAllModes()) {
|
||||||
if (!mode.isRanked())
|
if (!mode.isRanked())
|
||||||
@ -67,4 +71,9 @@ public class RankCommand extends BasicCommand {
|
|||||||
Message.send("RANK_EMBLEM", player, UserElo.getEmblemProgression(player, mode.getChatName(), user.getId()));
|
Message.send("RANK_EMBLEM", player, UserElo.getEmblemProgression(player, mode.getChatName(), user.getId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Mapper(value = "player", local = true)
|
||||||
|
public TypeMapper<String> playerTypeMapper() {
|
||||||
|
return SWCommandUtils.createMapper(s -> s, s -> BungeeCord.getInstance().getPlayers().stream().map(ProxiedPlayer::getName).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren