diff --git a/Essentials/src/main/resources/messages.properties b/Essentials/src/main/resources/messages.properties index 30513ae1d..33275ba59 100644 --- a/Essentials/src/main/resources/messages.properties +++ b/Essentials/src/main/resources/messages.properties @@ -240,6 +240,11 @@ discordbroadcastCommandUsage1Description=Sends the given message to the specifie discordbroadcastInvalidChannel=\u00a74Discord channel \u00a7c{0}\u00a74 does not exist. discordbroadcastPermission=\u00a74You do not have permission to send messages to the \u00a7c{0}\u00a74 channel. discordbroadcastSent=\u00a76Message sent to \u00a7c{0}\u00a76! +discordCommandDescription=Sends the discord invite link to the player. +discordCommandLink=\u00a76Join our Discord server at \u00a7c{0}\u00a76! +discordCommandUsage=/ +discordCommandUsage1=/ +discordCommandUsage1Description=Sends the discord invite link to the player discordCommandExecuteDescription=Executes a console command on the Minecraft server. discordCommandExecuteArgumentCommand=The command to be executed discordCommandExecuteReply=Executing command: "/{0}" diff --git a/EssentialsDiscord/src/main/java/net/essentialsx/discord/DiscordSettings.java b/EssentialsDiscord/src/main/java/net/essentialsx/discord/DiscordSettings.java index 18b9c702d..81a91907d 100644 --- a/EssentialsDiscord/src/main/java/net/essentialsx/discord/DiscordSettings.java +++ b/EssentialsDiscord/src/main/java/net/essentialsx/discord/DiscordSettings.java @@ -59,6 +59,10 @@ public class DiscordSettings implements IConf { return config.getLong("guild", 0); } + public String getDiscordUrl() { + return config.getString("discord-url", "https://discord.gg/invite-code"); + } + public long getPrimaryChannelId() { return config.getLong("channels.primary", 0); } diff --git a/EssentialsDiscord/src/main/java/net/essentialsx/discord/commands/Commanddiscord.java b/EssentialsDiscord/src/main/java/net/essentialsx/discord/commands/Commanddiscord.java new file mode 100644 index 000000000..49d2f2bdb --- /dev/null +++ b/EssentialsDiscord/src/main/java/net/essentialsx/discord/commands/Commanddiscord.java @@ -0,0 +1,19 @@ +package net.essentialsx.discord.commands; + +import com.earth2me.essentials.CommandSource; +import com.earth2me.essentials.commands.EssentialsCommand; +import net.essentialsx.discord.JDADiscordService; +import org.bukkit.Server; + +import static com.earth2me.essentials.I18n.tl; + +public class Commanddiscord extends EssentialsCommand { + public Commanddiscord() { + super("discord"); + } + + @Override + protected void run(Server server, CommandSource sender, String commandLabel, String[] args) { + sender.sendMessage(tl("discordCommandLink", ((JDADiscordService) module).getSettings().getDiscordUrl())); + } +} diff --git a/EssentialsDiscord/src/main/resources/config.yml b/EssentialsDiscord/src/main/resources/config.yml index badddea72..1c3072b87 100644 --- a/EssentialsDiscord/src/main/resources/config.yml +++ b/EssentialsDiscord/src/main/resources/config.yml @@ -17,6 +17,9 @@ token: "INSERT-TOKEN-HERE" # The ID of your server. guild: 000000000000000000 +# The Discord invite URL that will be shown when a player when using the /discord command or in other areas. +discord-url: "https://discord.gg/invite-code" + # Defined text channels # ===================== # diff --git a/EssentialsDiscord/src/main/resources/plugin.yml b/EssentialsDiscord/src/main/resources/plugin.yml index 5f9ed3019..fad076db5 100644 --- a/EssentialsDiscord/src/main/resources/plugin.yml +++ b/EssentialsDiscord/src/main/resources/plugin.yml @@ -12,4 +12,8 @@ commands: discordbroadcast: description: Broadcasts a message to the specified Discord channel. usage: / - aliases: [dbroadcast, dbc, dbcast, ediscordbroadcast, edbroadcast, edbc, edbcast] \ No newline at end of file + aliases: [dbroadcast, dbc, dbcast, ediscordbroadcast, edbroadcast, edbc, edbcast] + discord: + description: Sends the discord invite link to the player. + usage: / + aliases: [ediscord] \ No newline at end of file