mirror of
https://github.com/proxiodev/RedisBungee.git
synced 2024-11-05 04:48:02 +00:00
finsh up command system
This commit is contained in:
parent
78561fa467
commit
32826d843c
@ -13,6 +13,7 @@ package com.imaginarycode.minecraft.redisbungee.api.config;
|
|||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
import com.google.common.net.InetAddresses;
|
import com.google.common.net.InetAddresses;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -25,8 +26,10 @@ public class RedisBungeeConfiguration {
|
|||||||
private final boolean handleReconnectToLastServer;
|
private final boolean handleReconnectToLastServer;
|
||||||
private final boolean handleMotd;
|
private final boolean handleMotd;
|
||||||
|
|
||||||
|
private final CommandsConfiguration commandsConfiguration;
|
||||||
|
|
||||||
public RedisBungeeConfiguration(String proxyId, List<String> exemptAddresses, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd) {
|
|
||||||
|
public RedisBungeeConfiguration(String proxyId, List<String> exemptAddresses, boolean kickWhenOnline, boolean handleReconnectToLastServer, boolean handleMotd, CommandsConfiguration commandsConfiguration) {
|
||||||
this.proxyId = proxyId;
|
this.proxyId = proxyId;
|
||||||
ImmutableList.Builder<InetAddress> addressBuilder = ImmutableList.builder();
|
ImmutableList.Builder<InetAddress> addressBuilder = ImmutableList.builder();
|
||||||
for (String s : exemptAddresses) {
|
for (String s : exemptAddresses) {
|
||||||
@ -36,6 +39,7 @@ public class RedisBungeeConfiguration {
|
|||||||
this.kickWhenOnline = kickWhenOnline;
|
this.kickWhenOnline = kickWhenOnline;
|
||||||
this.handleReconnectToLastServer = handleReconnectToLastServer;
|
this.handleReconnectToLastServer = handleReconnectToLastServer;
|
||||||
this.handleMotd = handleMotd;
|
this.handleMotd = handleMotd;
|
||||||
|
this.commandsConfiguration = commandsConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getProxyId() {
|
public String getProxyId() {
|
||||||
@ -58,5 +62,21 @@ public class RedisBungeeConfiguration {
|
|||||||
return this.handleReconnectToLastServer;
|
return this.handleReconnectToLastServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record CommandsConfiguration(boolean redisbungeeEnabled, boolean redisbungeeLegacyEnabled,
|
||||||
|
@Nullable LegacySubCommandsConfiguration legacySubCommandsConfiguration) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record LegacySubCommandsConfiguration(boolean findEnabled, boolean glistEnabled, boolean ipEnabled,
|
||||||
|
boolean lastseenEnabled, boolean plistEnabled, boolean pproxyEnabled,
|
||||||
|
boolean sendtoallEnabled, boolean serveridEnabled,
|
||||||
|
boolean serveridsEnabled, boolean installFind, boolean installGlist, boolean installIp,
|
||||||
|
boolean installLastseen, boolean installPlist, boolean installPproxy,
|
||||||
|
boolean installSendtoall, boolean installServerid,
|
||||||
|
boolean installServerids) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandsConfiguration commandsConfiguration() {
|
||||||
|
return commandsConfiguration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -86,7 +86,42 @@ public interface ConfigLoader extends GenericConfigLoader {
|
|||||||
plugin.logInfo("handle reconnect to last server: {}", reconnectToLastServer);
|
plugin.logInfo("handle reconnect to last server: {}", reconnectToLastServer);
|
||||||
plugin.logInfo("handle motd: {}", handleMotd);
|
plugin.logInfo("handle motd: {}", handleMotd);
|
||||||
|
|
||||||
RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, kickWhenOnline, reconnectToLastServer, handleMotd);
|
|
||||||
|
// commands
|
||||||
|
boolean redisBungeeEnabled = node.getNode("commands", "redisbungee", "enabled").getBoolean();
|
||||||
|
boolean redisBungeeLegacyEnabled =node.getNode("commands", "redisbungee-legacy", "enabled").getBoolean();
|
||||||
|
|
||||||
|
boolean glistEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "glist", "enabled").getBoolean();
|
||||||
|
boolean findEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "find", "enabled").getBoolean();
|
||||||
|
boolean lastseenEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "lastseen", "enabled").getBoolean();
|
||||||
|
boolean ipEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "ip", "enabled").getBoolean();
|
||||||
|
boolean pproxyEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "pproxy", "enabled").getBoolean();
|
||||||
|
boolean sendToAllEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "sendtoall", "enabled").getBoolean();
|
||||||
|
boolean serverIdEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverid", "enabled").getBoolean();
|
||||||
|
boolean serverIdsEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverids", "enabled").getBoolean();
|
||||||
|
boolean pListEnabled = node.getNode("commands", "redisbungee-legacy", "subcommands", "plist", "enabled").getBoolean();
|
||||||
|
|
||||||
|
boolean installGlist = node.getNode("commands", "redisbungee-legacy", "subcommands", "glist", "install").getBoolean();
|
||||||
|
boolean installFind = node.getNode("commands", "redisbungee-legacy", "subcommands", "find", "install").getBoolean();
|
||||||
|
boolean installLastseen = node.getNode("commands", "redisbungee-legacy", "subcommands", "lastseen", "install").getBoolean();
|
||||||
|
boolean installIp = node.getNode("commands", "redisbungee-legacy", "subcommands", "ip", "install").getBoolean();
|
||||||
|
boolean installPproxy = node.getNode("commands", "redisbungee-legacy", "subcommands", "pproxy", "install").getBoolean();
|
||||||
|
boolean installSendToAll = node.getNode("commands", "redisbungee-legacy", "subcommands", "sendtoall", "install").getBoolean();
|
||||||
|
boolean installServerid = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverid", "install").getBoolean();
|
||||||
|
boolean installServerIds = node.getNode("commands", "redisbungee-legacy", "subcommands", "serverids", "install").getBoolean();
|
||||||
|
boolean installPlist = node.getNode("commands", "redisbungee-legacy", "subcommands", "plist", "install").getBoolean();
|
||||||
|
|
||||||
|
|
||||||
|
RedisBungeeConfiguration configuration = new RedisBungeeConfiguration(proxyId, exemptAddresses, kickWhenOnline, reconnectToLastServer, handleMotd, new RedisBungeeConfiguration.CommandsConfiguration(
|
||||||
|
redisBungeeEnabled, redisBungeeLegacyEnabled,
|
||||||
|
new RedisBungeeConfiguration.LegacySubCommandsConfiguration(
|
||||||
|
findEnabled, glistEnabled, ipEnabled,
|
||||||
|
lastseenEnabled, pListEnabled, pproxyEnabled,
|
||||||
|
sendToAllEnabled, serverIdEnabled, serverIdsEnabled,
|
||||||
|
installFind, installGlist, installIp,
|
||||||
|
installLastseen, installPlist, installPproxy,
|
||||||
|
installSendToAll, installServerid, installServerIds)
|
||||||
|
));
|
||||||
Summoner<?> summoner;
|
Summoner<?> summoner;
|
||||||
RedisBungeeMode redisBungeeMode;
|
RedisBungeeMode redisBungeeMode;
|
||||||
if (useSSL) {
|
if (useSSL) {
|
||||||
|
@ -50,7 +50,7 @@ proxy-id: "proxy-1"
|
|||||||
# which will break compatibility with old plugins that uses RedisBungee JedisPool
|
# which will break compatibility with old plugins that uses RedisBungee JedisPool
|
||||||
# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons.
|
# so to mitigate this issue, RedisBungee will create an JedisPool for compatibility reasons.
|
||||||
# disabled by default
|
# disabled by default
|
||||||
# ignored when cluster mode is enabled
|
# Automatically disabled when cluster mode is enabled
|
||||||
enable-jedis-pool-compatibility: false
|
enable-jedis-pool-compatibility: false
|
||||||
|
|
||||||
# max connections for the compatibility pool
|
# max connections for the compatibility pool
|
||||||
@ -69,12 +69,64 @@ handle-motd: true
|
|||||||
|
|
||||||
# A list of IP addresses for which RedisBungee will not modify the response for, useful for automatic
|
# A list of IP addresses for which RedisBungee will not modify the response for, useful for automatic
|
||||||
# restart scripts.
|
# restart scripts.
|
||||||
# ignored if handle-motd is disabled.
|
# Automatically disabled if handle-motd is disabled.
|
||||||
exempt-ip-addresses: []
|
exempt-ip-addresses: []
|
||||||
|
|
||||||
# disabled by default
|
# disabled by default
|
||||||
# RedisBungee will attempt to connect player to last server that was stored.
|
# RedisBungee will attempt to connect player to last server that was stored.
|
||||||
reconnect-to-last-server: false
|
reconnect-to-last-server: false
|
||||||
|
|
||||||
|
# For redis bungee legacy commands
|
||||||
|
# either can be run using '/rbl glist' for example
|
||||||
|
# or if 'install' is set to true '/glist' can be used.
|
||||||
|
# 'install' also overrides the proxy installed commands
|
||||||
|
#
|
||||||
|
# In legacy commands each command got it own permissions since they had it own permission pre new command system,
|
||||||
|
# so it's also applied to subcommands in '/rbl'.
|
||||||
|
commands:
|
||||||
|
# Permission redisbungee.legacy.use
|
||||||
|
redisbungee-legacy:
|
||||||
|
enabled: false
|
||||||
|
subcommands:
|
||||||
|
# Permission redisbungee.command.glist
|
||||||
|
glist:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.find
|
||||||
|
find:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.lastseen
|
||||||
|
lastseen:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.ip
|
||||||
|
ip:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.pproxy
|
||||||
|
pproxy:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.sendtoall
|
||||||
|
sendtoall:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.serverid
|
||||||
|
serverid:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.serverids
|
||||||
|
serverids:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.plist
|
||||||
|
plist:
|
||||||
|
enabled: false
|
||||||
|
install: false
|
||||||
|
# Permission redisbungee.command.use
|
||||||
|
redisbungee:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
# Config version DO NOT CHANGE!!!!
|
# Config version DO NOT CHANGE!!!!
|
||||||
config-version: 2
|
config-version: 2
|
||||||
|
@ -13,12 +13,19 @@ package com.imaginarycode.minecraft.redisbungee.commands;
|
|||||||
import co.aikar.commands.CommandManager;
|
import co.aikar.commands.CommandManager;
|
||||||
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
import com.imaginarycode.minecraft.redisbungee.api.RedisBungeePlugin;
|
||||||
|
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.legacy.LegacyRedisBungeeCommands;
|
||||||
|
|
||||||
public class CommandLoader {
|
public class CommandLoader {
|
||||||
|
|
||||||
public static void initCommands(CommandManager<?, ?, ?, ?, ?, ?> commandManager, RedisBungeePlugin<?> plugin) {
|
public static void initCommands(CommandManager<?, ?, ?, ?, ?, ?> commandManager, RedisBungeePlugin<?> plugin) {
|
||||||
|
var commandsConfiguration = plugin.configuration().commandsConfiguration();
|
||||||
|
if (commandsConfiguration.redisbungeeEnabled()) {
|
||||||
commandManager.registerCommand(new CommandRedisBungee(plugin));
|
commandManager.registerCommand(new CommandRedisBungee(plugin));
|
||||||
// todo: config options to disable each command
|
}
|
||||||
commandManager.registerCommand(new LegacyRedisBungeeCommands(plugin));
|
if (commandsConfiguration.redisbungeeLegacyEnabled()) {
|
||||||
|
commandManager.registerCommand(new LegacyRedisBungeeCommands(commandManager,plugin));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@CommandAlias("rb|redisbungee")
|
@CommandAlias("rb|redisbungee")
|
||||||
@CommandPermission("redisbungee.use")
|
@CommandPermission("redisbungee.command.use")
|
||||||
public class CommandRedisBungee extends AdventureBaseCommand {
|
public class CommandRedisBungee extends AdventureBaseCommand {
|
||||||
|
|
||||||
private final RedisBungeePlugin<?> plugin;
|
private final RedisBungeePlugin<?> plugin;
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("find|rfind")
|
||||||
|
@CommandPermission("redisbungee.command.find")
|
||||||
|
public class CommandFind extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandFind(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void find(CommandIssuer issuer, String[] args) {
|
||||||
|
rootCommand.find(issuer, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("glist|rglist")
|
||||||
|
@CommandPermission("redisbungee.command.glist")
|
||||||
|
public class CommandGList extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandGList(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void gList(CommandIssuer issuer, String[] args) {
|
||||||
|
rootCommand.gList(issuer, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("ip|playerip|rip|rplayerip")
|
||||||
|
@CommandPermission("redisbungee.command.ip")
|
||||||
|
public class CommandIp extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandIp(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void ip(CommandIssuer issuer, String[] args) {
|
||||||
|
this.rootCommand.ip(issuer, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("lastseen|rlastseend")
|
||||||
|
@CommandPermission("redisbungee.command.lastseen")
|
||||||
|
public class CommandLastSeen extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandLastSeen(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void lastSeen(CommandIssuer issuer, String[] args) {
|
||||||
|
this.rootCommand.lastSeen(issuer,args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("pproxy")
|
||||||
|
@CommandPermission("redisbungee.command.pproxy")
|
||||||
|
public class CommandPProxy extends AdventureBaseCommand {
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandPProxy(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void playerProxy(CommandIssuer issuer, String[] args) {
|
||||||
|
this.rootCommand.playerProxy(issuer,args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("plist|rplist")
|
||||||
|
@CommandPermission("redisbungee.command.plist")
|
||||||
|
public class CommandPlist extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandPlist(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void playerList(CommandIssuer issuer, String[] args) {
|
||||||
|
this.rootCommand.playerList(issuer, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("sendtoall|rsendtoall")
|
||||||
|
@CommandPermission("redisbungee.command.sendtoall")
|
||||||
|
public class CommandSendToAll extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandSendToAll(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
@Default
|
||||||
|
public void sendToAll(CommandIssuer issuer, String[] args) {
|
||||||
|
this.rootCommand.sendToAll(issuer, args);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("serverid|rserverid")
|
||||||
|
@CommandPermission("redisbungee.command.serverid")
|
||||||
|
public class CommandServerId extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandServerId(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
@Default
|
||||||
|
public void serverId(CommandIssuer issuer) {
|
||||||
|
this.rootCommand.serverId(issuer);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013-present RedisBungee contributors
|
||||||
|
*
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
*
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
|
import com.imaginarycode.minecraft.redisbungee.commands.utils.AdventureBaseCommand;
|
||||||
|
|
||||||
|
@CommandAlias("serverids|rserverids")
|
||||||
|
@CommandPermission("redisbungee.command.serverids")
|
||||||
|
public class CommandServerIds extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
|
private final LegacyRedisBungeeCommands rootCommand;
|
||||||
|
|
||||||
|
public CommandServerIds(LegacyRedisBungeeCommands rootCommand) {
|
||||||
|
this.rootCommand = rootCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void serverIds(CommandIssuer issuer) {
|
||||||
|
this.rootCommand.serverIds(issuer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -8,9 +8,10 @@
|
|||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.imaginarycode.minecraft.redisbungee.commands;
|
package com.imaginarycode.minecraft.redisbungee.commands.legacy;
|
||||||
|
|
||||||
import co.aikar.commands.CommandIssuer;
|
import co.aikar.commands.CommandIssuer;
|
||||||
|
import co.aikar.commands.CommandManager;
|
||||||
import co.aikar.commands.annotation.CommandAlias;
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
import co.aikar.commands.annotation.CommandPermission;
|
import co.aikar.commands.annotation.CommandPermission;
|
||||||
import co.aikar.commands.annotation.Subcommand;
|
import co.aikar.commands.annotation.Subcommand;
|
||||||
@ -29,15 +30,27 @@ import java.util.Set;
|
|||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandAlias("rbl|redisbungeeleagacy")
|
@CommandAlias("rbl|redisbungeelegacy")
|
||||||
@CommandPermission("redisbungee.leagacy.use")
|
@CommandPermission("redisbungee.legacy.use")
|
||||||
public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
||||||
|
|
||||||
|
|
||||||
private final RedisBungeePlugin<?> plugin;
|
private final RedisBungeePlugin<?> plugin;
|
||||||
|
|
||||||
public LegacyRedisBungeeCommands(RedisBungeePlugin<?> plugin) {
|
public LegacyRedisBungeeCommands(CommandManager<?, ?, ?, ?, ?, ?> commandManager, RedisBungeePlugin<?> plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
var commands = plugin.configuration().commandsConfiguration().legacySubCommandsConfiguration();
|
||||||
|
if (!plugin.configuration().commandsConfiguration().redisbungeeLegacyEnabled()) throw new IllegalStateException("someone tried to init me while disabled!");
|
||||||
|
if (commands == null) throw new NullPointerException("commands config is null!!");
|
||||||
|
|
||||||
|
if (commands.installGlist()) commandManager.registerCommand(new CommandGList(this));
|
||||||
|
if (commands.installFind()) commandManager.registerCommand(new CommandFind(this));
|
||||||
|
if (commands.installIp()) commandManager.registerCommand(new CommandIp(this));
|
||||||
|
if (commands.installLastseen()) commandManager.registerCommand(new CommandLastSeen(this));
|
||||||
|
if (commands.installPlist()) commandManager.registerCommand(new CommandPlist(this));
|
||||||
|
if (commands.installPproxy()) commandManager.registerCommand(new CommandPProxy(this));
|
||||||
|
if (commands.installSendtoall()) commandManager.registerCommand(new CommandSendToAll(this));
|
||||||
|
if (commands.installServerid()) commandManager.registerCommand(new CommandServerId(this));
|
||||||
|
if (commands.installServerids()) commandManager.registerCommand(new CommandServerIds(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Component NO_PLAYER_SPECIFIED =
|
private static final Component NO_PLAYER_SPECIFIED =
|
||||||
@ -52,7 +65,6 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("glist")
|
@Subcommand("glist")
|
||||||
@CommandAlias("glist")
|
|
||||||
@CommandPermission("redisbungee.command.glist")
|
@CommandPermission("redisbungee.command.glist")
|
||||||
public void gList(CommandIssuer issuer, String[] args) {
|
public void gList(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
||||||
@ -80,8 +92,8 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("find")
|
@Subcommand("find")
|
||||||
@CommandAlias("find")
|
|
||||||
@CommandPermission("redisbungee.command.find")
|
@CommandPermission("redisbungee.command.find")
|
||||||
public void find(CommandIssuer issuer, String[] args) {
|
public void find(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
||||||
@ -107,7 +119,6 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("lastseen")
|
@Subcommand("lastseen")
|
||||||
@CommandAlias("lastseen")
|
|
||||||
@CommandPermission("redisbungee.command.lastseen")
|
@CommandPermission("redisbungee.command.lastseen")
|
||||||
public void lastSeen(CommandIssuer issuer, String[] args) {
|
public void lastSeen(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
||||||
@ -139,7 +150,6 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("ip")
|
@Subcommand("ip")
|
||||||
@CommandAlias("ip")
|
|
||||||
@CommandPermission("redisbungee.command.ip")
|
@CommandPermission("redisbungee.command.ip")
|
||||||
public void ip(CommandIssuer issuer, String[] args) {
|
public void ip(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
||||||
@ -163,7 +173,6 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("pproxy")
|
@Subcommand("pproxy")
|
||||||
@CommandAlias("pproxy")
|
|
||||||
@CommandPermission("redisbungee.command.pproxy")
|
@CommandPermission("redisbungee.command.pproxy")
|
||||||
public void playerProxy(CommandIssuer issuer, String[] args) {
|
public void playerProxy(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
||||||
@ -188,7 +197,6 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("sendtoall")
|
@Subcommand("sendtoall")
|
||||||
@CommandAlias("sendtoall")
|
|
||||||
@CommandPermission("redisbungee.command.sendtoall")
|
@CommandPermission("redisbungee.command.sendtoall")
|
||||||
public void sendToAll(CommandIssuer issuer, String[] args) {
|
public void sendToAll(CommandIssuer issuer, String[] args) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
@ -203,22 +211,19 @@ public class LegacyRedisBungeeCommands extends AdventureBaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("serverid")
|
@Subcommand("serverid")
|
||||||
@CommandAlias("serverid")
|
|
||||||
@CommandPermission("redisbungee.command.serverid")
|
@CommandPermission("redisbungee.command.serverid")
|
||||||
public void serverId(CommandIssuer issuer) {
|
public void serverId(CommandIssuer issuer) {
|
||||||
sendMessage(issuer, Component.text("You are on " + plugin.getAbstractRedisBungeeApi().getProxyId() + ".", NamedTextColor.YELLOW));
|
sendMessage(issuer, Component.text("You are on " + plugin.getAbstractRedisBungeeApi().getProxyId() + ".", NamedTextColor.YELLOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subcommand("serverids")
|
@Subcommand("serverids")
|
||||||
@CommandAlias("serverids")
|
|
||||||
@CommandPermission("redisbungee.command.serverids")
|
@CommandPermission("redisbungee.command.serverids")
|
||||||
public void serverIds(CommandIssuer issuer) {
|
public void serverIds(CommandIssuer issuer) {
|
||||||
sendMessage(issuer, Component.text("All server IDs: " + Joiner.on(", ").join(plugin.getAbstractRedisBungeeApi().getAllProxies()), NamedTextColor.YELLOW));
|
sendMessage(issuer, Component.text("All Proxies IDs: " + Joiner.on(", ").join(plugin.getAbstractRedisBungeeApi().getAllProxies()), NamedTextColor.YELLOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Subcommand("plist")
|
@Subcommand("plist")
|
||||||
@CommandAlias("plist")
|
|
||||||
@CommandPermission("redisbungee.command.plist")
|
@CommandPermission("redisbungee.command.plist")
|
||||||
public void playerList(CommandIssuer issuer, String[] args) {
|
public void playerList(CommandIssuer issuer, String[] args) {
|
||||||
plugin.executeAsync(() -> {
|
plugin.executeAsync(() -> {
|
Loading…
Reference in New Issue
Block a user