com.velocitypowered.api.proxy.ConsoleCommandSource Java Examples

The following examples show how to use com.velocitypowered.api.proxy.ConsoleCommandSource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VelocityCommandSender.java    From Geyser with MIT License 5 votes vote down vote up
@Override
public String getName() {
    if (handle instanceof Player) {
        return ((Player) handle).getUsername();
    } else if (handle instanceof ConsoleCommandSource) {
        return "CONSOLE";
    }
    return "";
}
 
Example #2
Source File: VelocityCommandSender.java    From spark with GNU General Public License v3.0 5 votes vote down vote up
@Override
public String getName() {
    if (super.delegate instanceof Player) {
        return ((Player) super.delegate).getUsername();
    } else if (super.delegate instanceof ConsoleCommandSource) {
        return "Console";
    } else {
        return "unknown:" + super.delegate.getClass().getSimpleName();
    }
}
 
Example #3
Source File: VelocityCommandExecutor.java    From LuckPerms with MIT License 5 votes vote down vote up
public void register() {
    ProxyServer proxy = this.plugin.getBootstrap().getProxy();
    proxy.getCommandManager().register(this, ALIASES);

    // register slash aliases so the console can run '/lpv' in the same way as 'lpv'.
    proxy.getCommandManager().register(new ForwardingCommand(this) {
        @Override
        public boolean hasPermission(CommandSource source, @NonNull String[] args) {
            return source instanceof ConsoleCommandSource;
        }
    }, SLASH_ALIASES);
}
 
Example #4
Source File: VelocityCommandSender.java    From Geyser with MIT License 4 votes vote down vote up
@Override
public boolean isConsole() {
    return handle instanceof ConsoleCommandSource;
}