fix /server
This commit is contained in:
parent
7cfb423c70
commit
d1955da813
3 changed files with 25 additions and 12 deletions
|
@ -40,7 +40,7 @@ public class VTools {
|
|||
server.getCommandManager().register("staffchat", new CommandStaffChat(server), "sc");
|
||||
server.getCommandManager().register("restart", new CommandRestart(server));
|
||||
server.getCommandManager().register("tps", new CommandTp(server), "jump");
|
||||
server.getCommandManager().register("server", new CommandServer(server));
|
||||
server.getCommandManager().register("server", new CommandServer(server), "serverv");
|
||||
server.getCommandManager().register("servers", new CommandServers(server), "allservers");
|
||||
new TGBridge(this).register();
|
||||
new PlayerStatus(this).register();
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package de.strifel.VTools.commands;
|
||||
|
||||
import com.velocitypowered.api.command.CommandSource;
|
||||
import com.velocitypowered.api.command.SimpleCommand;
|
||||
import com.velocitypowered.api.proxy.Player;
|
||||
import com.velocitypowered.api.proxy.ProxyServer;
|
||||
import de.strifel.VTools.commands.utils.ServerUtil;
|
||||
import net.kyori.adventure.text.Component;
|
||||
|
||||
import static de.strifel.VTools.VTools.COLOR_RED;
|
||||
|
||||
public class CommandServer extends ServerUtil implements SimpleCommand {
|
||||
|
||||
|
@ -16,15 +18,24 @@ public class CommandServer extends ServerUtil implements SimpleCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Invocation commandInvocation) {
|
||||
CommandSource invocationSource = commandInvocation.source();
|
||||
if (invocationSource.hasPermission("vtools.servertp.auto") && invocationSource instanceof Player) {
|
||||
Player player = (Player)invocationSource;
|
||||
if (server.getAllPlayers().stream().anyMatch(p -> p.hasPermission("vtools.send") && p.hasPermission("vtools.send.revcmsg"))) {
|
||||
return true;
|
||||
public void execute(final SimpleCommand.Invocation invocation) {
|
||||
if (invocation.source() instanceof Player) {
|
||||
if (
|
||||
invocation.source().hasPermission("velocity.command.server") ||
|
||||
server.getAllPlayers().stream().anyMatch(p -> p.hasPermission("vtools.send") && p.hasPermission("vtools.send.recvmsg"))) {
|
||||
super.execute(invocation);
|
||||
}
|
||||
else {
|
||||
invocation.source().sendMessage(Component.text("Supervisor offline.").color(COLOR_RED));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else return invocationSource.hasPermission("vtools.servertp");
|
||||
else {
|
||||
invocation.source().sendMessage(Component.text("Command is only for players.").color(COLOR_RED));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Invocation commandInvocation) {
|
||||
return commandInvocation.source().hasPermission("vtools.server.auto");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,10 +54,12 @@ public class GlistUtil {
|
|||
|
||||
TextComponent.Builder builder = Component.text()
|
||||
.append(Component.text("[" + server.getServerInfo().getName() + "] ",
|
||||
NamedTextColor.DARK_AQUA))
|
||||
NamedTextColor.DARK_AQUA)
|
||||
.clickEvent(ClickEvent.runCommand("/server " + server.getServerInfo().getName()))
|
||||
|
||||
)
|
||||
.append(Component.text("(" + onServer.size() + ")", NamedTextColor.GRAY))
|
||||
.append(Component.text(": "))
|
||||
.clickEvent(ClickEvent.runCommand("/server " + server.getServerInfo().getName()))
|
||||
.resetStyle();
|
||||
|
||||
for (int i = 0; i < onServer.size(); i++) {
|
||||
|
|
Loading…
Reference in a new issue