SteamWar/BungeeCore
Archiviert
13
2

Implementing WHOIS command #69

Zusammengeführt
Lixfel hat 1 Commits von whoisCommand nach master 2020-04-08 15:42:00 +02:00 zusammengeführt
2 geänderte Dateien mit 47 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -90,6 +90,7 @@ public class BungeeCore extends Plugin {
new PollCommand();
new MuteCommand();
new BugCommand();
new WhoisCommand();
new EventStarter();
new Broadcaster();

Datei anzeigen

@ -0,0 +1,46 @@
package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.BungeeCore;
import de.steamwar.bungeecore.sql.SteamwarUser;
import de.steamwar.bungeecore.sql.Team;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
public class WhoisCommand extends BasicCommand {
public WhoisCommand(){
super("whois", "bungeecore.teamchat");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(!(sender instanceof ProxiedPlayer))
return;
ProxiedPlayer player = (ProxiedPlayer) sender;
if(args.length == 0){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§c/whois [Spieler]");
return;
}
SteamwarUser user = SteamwarUser.get(args[0]);
if(user == null){
BungeeCore.send(player, BungeeCore.CHAT_PREFIX + "§cUnbekannter Spieler.");
return;
}
BungeeCore.send(player, "§7Username§8: §e" + user.getUserName());
BungeeCore.send(player, "§7UUID§8: §e" + user.getUuid().toString(), "", new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, user.getUuid().toString()));
BungeeCore.send(player, "§7ID§8: §e" + user.getId());
Team team = Team.get(user.getTeam());
BungeeCore.send(player, "§7Team§8: §e" + team.getTeamName());
if(user.isBanned()){
player.sendMessage(user.banMessage());
}
if(user.isMuted()){
player.sendMessage(user.muteMessage());
}
}
}