diff --git a/README.md b/README.md index c2f4c14..44d2174 100644 --- a/README.md +++ b/README.md @@ -12,19 +12,23 @@ # [StaffChat](https://oskar3123.github.io/StaffChat) -Simple and highly configurable staffchat +Simple and highly configurable staff chat. ## Download -You can download the plugin from the [Spigot resource page](https://www.spigotmc.org/resources/37804/) or via the [GitHub releases](https://github.com/oskar3123/StaffChat/releases) +You can download the plugin from +the [Spigot resource page](https://www.spigotmc.org/resources/37804/) or via +the [GitHub releases](https://github.com/oskar3123/StaffChat/releases). ## License -This plugin is licensed with the MIT License, for more information see the [LICENSE file](https://github.com/oskar3123/StaffChat/blob/master/LICENSE) +This plugin is licensed with the MIT License, for more information see +the [LICENSE file](https://github.com/oskar3123/StaffChat/blob/master/LICENSE). ## Building -To build this yourself just clone the repository and run the `shadowJar` task with the Gradle Wrapper +To build this yourself just clone the repository and run the `shadowJar` task with the Gradle +Wrapper. ### Windows @@ -46,52 +50,53 @@ cd StaffChat ### Bukkit/Spigot -Because the event API in 1.14+ is now strict between sync and async events you should check whether this was called synchronously or asynchronously by using `event.isAsynchronous()` +Because the event API in 1.14+ is now strict between sync and async events you should check whether +this was called synchronously or asynchronously by using `event.isAsynchronous()`. ```java -public class StaffChatListener implements Listener -{ - - @EventHandler - public void onStaffChat(StaffChatEvent event) - { - // String format = event.getFormat(); - // event.setFormat("&b{NAME} >> {MESSAGE}"); - // String message = event.getMessage(); - // Player player = event.getPlayer(); - // event.setCancelled(true); - } +public class StaffChatListener implements Listener { + @EventHandler + public void onStaffChat(StaffChatEvent event) { + // String format = event.getFormat(); + // event.setFormat("&b{NAME} >> {MESSAGE}"); + // String message = event.getMessage(); + // Player player = event.getPlayer(); + // event.setCancelled(true); + } } ``` + Register the listener with + ```java getServer().getPluginManager().registerEvents(new StaffChatListener(), this); ``` + in your plugin onEnable. ### BungeeCord ```java -public class StaffChatListener implements Listener -{ - - @EventHandler - public void onStaffChat(BungeeStaffChatEvent event) - { - // String format = event.getFormat(); - // event.setFormat("&b{NAME} >> {MESSAGE}"); - // String message = event.getMessage(); - // Player player = event.getPlayer(); - // event.setCancelled(true); - } +public class StaffChatListener implements Listener { + @EventHandler + public void onStaffChat(BungeeStaffChatEvent event) { + // String format = event.getFormat(); + // event.setFormat("&b{NAME} >> {MESSAGE}"); + // String message = event.getMessage(); + // Player player = event.getPlayer(); + // event.setCancelled(true); + } } ``` + Register the listener with + ```java getProxy().getPluginManager().registerListener(this, new StaffChatListener()); ``` + in your plugin onEnable. ### Velocity @@ -117,7 +122,9 @@ public class StaffChatListener { } } ``` + Register the listener on the `ProxyInitializeEvent` in your plugin. + ```java @Plugin public class Plugin { @@ -134,4 +141,4 @@ public class Plugin { server.getEventManager().register(this, new StaffChatListener()); } } -``` \ No newline at end of file +```