SteamWar/BungeeCore
Archiviert
13
2

Update JoinmeCommand
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed

Dieser Commit ist enthalten in:
yoyosource 2023-01-21 22:22:55 +01:00
Ursprung 29945a351b
Commit 647702c0b0

Datei anzeigen

@ -21,30 +21,26 @@ package de.steamwar.bungeecore.commands;
import de.steamwar.bungeecore.*; import de.steamwar.bungeecore.*;
import de.steamwar.bungeecore.sql.BauweltMember; import de.steamwar.bungeecore.sql.BauweltMember;
import net.md_5.bungee.api.CommandSender; import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.ClickEvent; import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.config.ServerInfo; import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList; public class JoinmeCommand extends SWCommand {
public class JoinmeCommand extends BasicCommand {
public JoinmeCommand() { public JoinmeCommand() {
super("joinme", ""); super("joinme");
} }
@Override @Register(description = "JOINME_USAGE")
public void execute(CommandSender sender, String[] args) { public void genericCommand(ProxiedPlayer player) {
if(sender instanceof ProxiedPlayer) { if (!player.hasPermission("bungeecore.joinme")) return;
ProxiedPlayer player = (ProxiedPlayer) sender; Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER",
new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName());
}
if (args.length == 0 && player.hasPermission("bungeecore.joinme")) { @Register
Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER" public void genericCommand(ProxiedPlayer player, ProxiedPlayer target) {
, new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/join " + player.getName()), player.getName(), player.getServer().getInfo().getName());
} else if (args.length == 1) {
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
if(target == null || !target.isConnected()){ if(target == null || !target.isConnected()){
Message.send("JOINME_PLAYER_OFFLINE", player); Message.send("JOINME_PLAYER_OFFLINE", player);
return; return;
@ -81,17 +77,5 @@ public class JoinmeCommand extends BasicCommand {
}else{ }else{
player.connect(server); player.connect(server);
} }
} else {
Message.send("JOINME_USAGE", player);
}
}
}
@Override
public Iterable<String> onTabComplete(CommandSender commandSender, String[] args) {
if(args.length == 1){
return allPlayers(args[0]);
}
return new ArrayList<>();
} }
} }