CommandSender sender = ...; // get the CommandSender object String message = "Hello, world!"; sender.sendMessage(message);
CommandSender sender = ...; // get the CommandSender object String permission = "myplugin.mypermission"; if (sender.hasPermission(permission)) { // do something that requires the permission } else { sender.sendMessage("You don't have the required permission."); }This will check if the CommandSender has the "myplugin.mypermission" permission and do something if it has, or send a message if it doesn't. Overall, the CommandSender is an important part of Bukkit plugins and allows plugins to interact with the console, players, and command blocks in a uniform way.