Merge pull request 'Update IgnoreCommand' (#384) from CommandIgnore into master
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Reviewed-on: #384 Reviewed-by: Lixfel <lixfel@steamwar.de>
Dieser Commit ist enthalten in:
Commit
0e430fee9b
@ -22,28 +22,26 @@ package de.steamwar.bungeecore.commands;
|
|||||||
import de.steamwar.bungeecore.Message;
|
import de.steamwar.bungeecore.Message;
|
||||||
import de.steamwar.bungeecore.sql.IgnoreSystem;
|
import de.steamwar.bungeecore.sql.IgnoreSystem;
|
||||||
import de.steamwar.bungeecore.sql.SteamwarUser;
|
import de.steamwar.bungeecore.sql.SteamwarUser;
|
||||||
|
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;
|
||||||
|
|
||||||
public class IgnoreCommand extends BasicCommand {
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public class IgnoreCommand extends SWCommand {
|
||||||
|
|
||||||
public IgnoreCommand() {
|
public IgnoreCommand() {
|
||||||
super("ignore", null);
|
super("ignore", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Register(description = "USAGE_IGNORE")
|
||||||
public void execute(CommandSender sender, String[] args) {
|
public void genericCommand(ProxiedPlayer p, @Mapper("player") String toIgnore) {
|
||||||
if(args.length < 1) {
|
|
||||||
Message.send("USAGE_IGNORE", sender);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(sender instanceof ProxiedPlayer))
|
|
||||||
return;
|
|
||||||
ProxiedPlayer p = (ProxiedPlayer) sender;
|
|
||||||
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
SteamwarUser user = SteamwarUser.get(p.getUniqueId());
|
||||||
|
|
||||||
SteamwarUser target = SteamwarUser.get(args[0]);
|
SteamwarUser target = SteamwarUser.get(toIgnore);
|
||||||
if(target == null){
|
if(target == null){
|
||||||
Message.send("UNKNOWN_PLAYER", p);
|
Message.send("UNKNOWN_PLAYER", p);
|
||||||
return;
|
return;
|
||||||
@ -60,4 +58,9 @@ public class IgnoreCommand extends BasicCommand {
|
|||||||
IgnoreSystem.ignore(user, target);
|
IgnoreSystem.ignore(user, target);
|
||||||
Message.send("IGNORE_MESSAGE", p, target.getUserName());
|
Message.send("IGNORE_MESSAGE", p, target.getUserName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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