org.bukkit.command.RemoteConsoleCommandSender Java Examples

The following examples show how to use org.bukkit.command.RemoteConsoleCommandSender. 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: VanillaCommandWrapper.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
private net.minecraft.command.ICommandSender getListener(CommandSender sender) {
    if (sender instanceof Player) {
        return ((CraftPlayer) sender).getHandle();
    }
    if (sender instanceof BlockCommandSender) {
        return ((CraftBlockCommandSender) sender).getTileEntity();
    }
    if (sender instanceof CommandMinecart) {
        return ((net.minecraft.entity.EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).func_145822_e();
    }
    if (sender instanceof RemoteConsoleCommandSender) {
        return net.minecraft.network.rcon.RConConsoleSource.instance;
    }
    if (sender instanceof ConsoleCommandSender) {
        return ((CraftServer) sender.getServer()).getServer();
    }
    return null;
}
 
Example #2
Source File: TimingsCommand.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
@Override
public synchronized void start() {
    if (sender instanceof RemoteConsoleCommandSender) {
        run();
    } else {
        super.start();
    }
}
 
Example #3
Source File: BukkitSenderFactory.java    From LuckPerms with MIT License 5 votes vote down vote up
@Override
protected void sendMessage(CommandSender sender, String s) {
    // we can safely send async for players and the console
    if (sender instanceof Player || sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender) {
        sender.sendMessage(s);
        return;
    }

    // otherwise, send the message sync
    getPlugin().getBootstrap().getScheduler().executeSync(new SyncMessengerAgent(sender, s));
}
 
Example #4
Source File: MyCommand.java    From NBTEditor with GNU General Public License v3.0 5 votes vote down vote up
public boolean isValidSender(CommandSender sender) {
	switch (this) {
	case PLAYER_ONLY:
		return (sender instanceof Player);
	case NO_PLAYER:
		return (sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender || sender instanceof BlockCommandSender);
	case CONSOLE_ONLY:
		return (sender instanceof ConsoleCommandSender || sender instanceof RemoteConsoleCommandSender);
	case BLOCK_ONLY:
		return (sender instanceof BlockCommandSender);
	case DEFAULT:
		return true;
	}
	return false;
}