Skip to content

CmdWebhooks Logs all Joins, Leaves, Commands, Chat and more to your Discord server using webhooks!

License

Notifications You must be signed in to change notification settings

OllieJW/CmdWebhooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

CmdWebhooks

CmdWebhooks Logs all Joins, Leaves, Commands, Chat and more to your Discord server using webhooks!

API Usage

pom.xml:

<dependencies>
    <dependency>
        <groupId>me.olliejw</groupId>
        <artifactId>CmdWebhooks</artifactId>
        <version>LATEST</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Usage:

import me.olliejw.cmdwebhooks.SendWebhook;

public class PlayerJoin implements Listener {
    @EventHandler
    public void playerJoins(PlayerJoinEvent event) {
        String playerName = event.getPlayer().getDisplayName();
        
        SendWebhook webhook = new SendWebhook("URL");
        
        String content = ("[player] has joined!").replace("[player]", playerName);
        
        webhook.setContent(content); // Sets the message content

        try {
            webhook.execute(); // Sends message to Discord
        } catch (MalformedURLException var5) {
            System.out.println("[CmdWebhook] Error sending Webhook!");
        } catch (IOException var6) {
            var6.printStackTrace();
        }
    }
}

About

CmdWebhooks Logs all Joins, Leaves, Commands, Chat and more to your Discord server using webhooks!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages