diff --git a/README.md b/README.md index af1e955..d9c2bfe 100644 --- a/README.md +++ b/README.md @@ -1 +1,41 @@ -# DiscordWebhook \ No newline at end of file +# DiscordWebhook + +If you are looking for the binary version of the plugin, just head over +to https://www.spigotmc.org/resources/discord-webhook.51537/ + + +## How to Install + +Assuming you are installing from a build: + +You will first need to have a [Spigot](https://www.spigotmc.org/) +Minecraft server running. Then copy the following JAR to the Spigot +build folder: + +DiscordWebhook-Spigot-1.0.1-jar-with-dependencies.jar + +## How to Configure + +On first launch the server will complain that the "The Webhook URL is empty!". +At this point modify the new `DiscordWebhook/config.yml` that was created +in the plugin folder. + +Set the URL to the one given to you by Discord and then restart the server. +At this point you should see your first message in the Discord channel you +created the webhook for. + +## How to Build + +If you are looking to make changes, then you'll need to get both the JDK +(Java Development Kit) and Maven installed on your computer. + +These may be available via your system's package manager (apt, chocolatey, brew, MacPorts) or directly from the source sites: + + - https://www.oracle.com/java/technologies/javase-downloads.html + - https://maven.apache.org/ + +Once you have them set up you'll need to run Maven: + +``` +mvn package +``` \ No newline at end of file diff --git a/src/main/java/me/artuto/discordwebhook/CommandHandler.java b/src/main/java/me/artuto/discordwebhook/CommandHandler.java index 77ec06c..1046828 100644 --- a/src/main/java/me/artuto/discordwebhook/CommandHandler.java +++ b/src/main/java/me/artuto/discordwebhook/CommandHandler.java @@ -26,26 +26,29 @@ public class CommandHandler implements CommandExecutor @Override public boolean onCommand(CommandSender executor, Command cmd, String label, String[] args) { - switch(cmd.getName().toLowerCase()) + if (cmd.getName().toLowerCase().equals("webhook")) { - case "webhook": - if(args.length==0) - executor.sendMessage(ChatColor.DARK_BLUE+"-====== Webhook Help ======-"+ChatColor.RESET + - "\n/webhook about - Shows information about the plugin" + - "\n/webhook help - Shows this message"); - else if(args[0].equals("about")) - executor.sendMessage("Plugin made by "+ChatColor.GREEN+"Artuto" + - ChatColor.RESET+"\nPlugin Version: "+ChatColor.GREEN+Const.VERSION+ChatColor.RESET + - "\nDonations are accepted! "+ChatColor.AQUA+"https://paypal.me/artuto"); - else if(args[0].equals("help")) - executor.sendMessage(ChatColor.DARK_BLUE+"-====== Webhook Help ======-"+ChatColor.RESET + - "\n/webhook about - Shows information about the plugin" + - "\n/webhook help - Shows this message"); - break; - default: - return false; + if(args.length==0) + { + executor.sendMessage(ChatColor.DARK_BLUE+"-====== Webhook Help ======-"+ChatColor.RESET + + "\n/webhook about - Shows information about the plugin" + + "\n/webhook help - Shows this message"); + } + else if(args[0].equals("about")) + { + executor.sendMessage("Plugin made by "+ChatColor.GREEN+"Artuto" + + ChatColor.RESET+"\nPlugin Version: "+ChatColor.GREEN+Const.VERSION+ChatColor.RESET + + "\nDonations are accepted! "+ChatColor.AQUA+"https://paypal.me/artuto"); + } + else if(args[0].equals("help")) + { + executor.sendMessage(ChatColor.DARK_BLUE+"-====== Webhook Help ======-"+ChatColor.RESET + + "\n/webhook about - Shows information about the plugin" + + "\n/webhook help - Shows this message"); + } + return true; } - return true; + return false; } } diff --git a/src/main/java/me/artuto/discordwebhook/EventListener.java b/src/main/java/me/artuto/discordwebhook/EventListener.java index 968934e..dba98c1 100644 --- a/src/main/java/me/artuto/discordwebhook/EventListener.java +++ b/src/main/java/me/artuto/discordwebhook/EventListener.java @@ -61,6 +61,6 @@ public void onPluginDisable(PluginDisableEvent event) { if(!(event.getPlugin().getName().equals("DiscordWebhook"))) return; - Sender.shutdown(event.getSender().getServer(), config.getUrl()); + Sender.shutdown(event.getPlugin().getServer(), config.getUrl()); } }