SteamWar/BungeeCore
Archiviert
13
2

Merge branch 'whoisCommand' of SteamWar/BungeeCore into master

Dieser Commit ist enthalten in:
Lixfel 2020-04-08 15:41:49 +02:00 committet von Gitea
Commit b3ba571fca
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());
}
}
}