public void onPlayerJoin(PlayerJoinEvent event) { getLogger().info(event.getPlayer().getName() + " has joined the server!"); }
public void onEnable() { try { loadConfig(); } catch (IOException e) { getLogger().severe("Failed to load config file: " + e.getMessage()); } } private void loadConfig() throws IOException { // load configuration file }This code is part of a plugin's onEnable method, which is called when the plugin is enabled. It tries to load a configuration file and logs a severe error message if there is an IOException. In both examples, the package library is org.bukkit.