Dieser Commit ist enthalten in:
Ursprung
29945a351b
Commit
647702c0b0
@ -21,77 +21,61 @@ 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());
|
if(target == null || !target.isConnected()){
|
||||||
} else if (args.length == 1) {
|
Message.send("JOINME_PLAYER_OFFLINE", player);
|
||||||
ProxiedPlayer target = ProxyServer.getInstance().getPlayer(args[0]);
|
return;
|
||||||
if(target == null || !target.isConnected()){
|
}else if(target.equals(player)){
|
||||||
Message.send("JOINME_PLAYER_OFFLINE", player);
|
Message.send("JOINME_PLAYER_SELF", player);
|
||||||
return;
|
return;
|
||||||
}else if(target.equals(player)){
|
}
|
||||||
Message.send("JOINME_PLAYER_SELF", player);
|
ServerInfo server = target.getServer().getInfo();
|
||||||
return;
|
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
|
||||||
}
|
Subserver subserver = Subserver.getSubserver(target);
|
||||||
ServerInfo server = target.getServer().getInfo();
|
|
||||||
String serverPerm = BungeeCore.serverPermissions.get(server.getName());
|
|
||||||
Subserver subserver = Subserver.getSubserver(target);
|
|
||||||
|
|
||||||
if(subserver != null) {
|
if(subserver != null) {
|
||||||
Servertype type = subserver.getType();
|
Servertype type = subserver.getType();
|
||||||
if (type == Servertype.ARENA) {
|
if (type == Servertype.ARENA) {
|
||||||
SubserverSystem.sendPlayer(subserver, player);
|
SubserverSystem.sendPlayer(subserver, player);
|
||||||
} else if (type == Servertype.BAUSERVER) {
|
} else if (type == Servertype.BAUSERVER) {
|
||||||
Bauserver bauserver = (Bauserver) subserver;
|
Bauserver bauserver = (Bauserver) subserver;
|
||||||
if (bauserver.getOwner().equals(player.getUniqueId()) ||
|
if (bauserver.getOwner().equals(player.getUniqueId()) ||
|
||||||
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
BauweltMember.getBauMember(bauserver.getOwner(), player.getUniqueId()) != null) {
|
||||||
SubserverSystem.sendPlayer(subserver, player);
|
SubserverSystem.sendPlayer(subserver, player);
|
||||||
} else {
|
} else {
|
||||||
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
SubserverSystem.sendDeniedMessage(player, bauserver.getOwner());
|
||||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
|
||||||
}
|
|
||||||
} else if(type == Servertype.BUILDER && !player.hasPermission("bungeecore.server.team")) {
|
|
||||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
|
||||||
} else {
|
|
||||||
SubserverSystem.sendPlayer(subserver, player);
|
|
||||||
}
|
|
||||||
}else if(serverPerm != null && !player.hasPermission(serverPerm)){
|
|
||||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||||
}else if(serverPerm == null && !player.getGroups().contains("team")) {
|
|
||||||
Message.send("JOIN_PLAYER_BLOCK", player);
|
|
||||||
}else{
|
|
||||||
player.connect(server);
|
|
||||||
}
|
}
|
||||||
|
} else if(type == Servertype.BUILDER && !player.hasPermission("bungeecore.server.team")) {
|
||||||
|
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||||
} else {
|
} else {
|
||||||
Message.send("JOINME_USAGE", player);
|
SubserverSystem.sendPlayer(subserver, player);
|
||||||
}
|
}
|
||||||
|
}else if(serverPerm != null && !player.hasPermission(serverPerm)){
|
||||||
|
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||||
|
}else if(serverPerm == null && !player.getGroups().contains("team")) {
|
||||||
|
Message.send("JOIN_PLAYER_BLOCK", player);
|
||||||
|
}else{
|
||||||
|
player.connect(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterable<String> onTabComplete(CommandSender commandSender, String[] args) {
|
|
||||||
if(args.length == 1){
|
|
||||||
return allPlayers(args[0]);
|
|
||||||
}
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren