packagecc.synkdev.example;publicclassMainextendsJavaPluginimplementsListener { @OverridepublicvoidonEnable() {//register the EventHandlersBukkit.getPluginManager().registerEvents(this,this); } @EventHandlerpublicvoidonDelete(MessageDeleteEvent event) {for (Player p :Bukkit.getOnlinePlayers()) {if (((OfflinePlayer) p).isOp()) {p.sendMessage(event.getPlayer().getName()+"'s message was just deleted! Here it is:\n"+event.getMessage()));//this will broadcast to all op players that the player has swore in chat } } } @EventHandlerpublicvoidonCensor(ChatCensorEvent event) {for (Player p :Bukkit.getOnlinePlayers()) {if (((OfflinePlayer) p).isOp()) {p.sendMessage(event.getPlayer().getName()+"'s message was just censored! Here it is:\n"+event.getMessage()));//this will broadcast to all op players that the player has swore in chat } } }}
With Spigot: Here I am sending to all OP players that the player has swore in chat.
packagecc.synkdev.example;publicclassMainextendsPluginimplementsListener { @OverridepublicvoidonEnable() {getProxy().getPluginManager().registerListener(this,this); } @EventHandlerpublicvoidonDelete(MessageDeleteEvent event) {getProxy().broadcast(event.getPlayer().getName()+" just swore.");getProxy().broadcast("Don't be like "+event.getPlayer().getName()+"!");getProxy().broadcast("Don't say "+event.getMessage()); }}
With BungeeCord: Here I am sending a message to all players on the proxy when a message gets deleted (please don't do that)
An example use case would be to interact with a punishment plugin to punish the player when they get censored.