Archiviert
1
0

Update JoinmeCommand

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.sql.BauweltMember;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import de.steamwar.command.SWCommand;
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.config.ServerInfo;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import java.util.ArrayList;
public class JoinmeCommand extends BasicCommand {
public class JoinmeCommand extends SWCommand {
public JoinmeCommand() {
super("joinme", "");
super("joinme");
}
@Override
public void execute(CommandSender sender, String[] args) {
if(sender instanceof ProxiedPlayer) {
ProxiedPlayer player = (ProxiedPlayer) sender;
@Register(description = "JOINME_USAGE")
public void genericCommand(ProxiedPlayer player) {
if (!player.hasPermission("bungeecore.joinme")) return;
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")) {
Message.broadcast("JOINME_BROADCAST", "JOINME_BROADCAST_HOVER"
, 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]);
@Register
public void genericCommand(ProxiedPlayer player, ProxiedPlayer target) {
if(target == null || !target.isConnected()){
Message.send("JOINME_PLAYER_OFFLINE", player);
return;
@ -81,17 +77,5 @@ public class JoinmeCommand extends BasicCommand {
}else{
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<>();
}
}