mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 17:18:37 +01:00
Add /discord command to display invite code (#4620)
This commit is contained in:
parent
8f679de352
commit
680d3230ea
@ -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=/<command>
|
||||
discordCommandUsage1=/<command>
|
||||
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}"
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
}
|
@ -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
|
||||
# =====================
|
||||
#
|
||||
|
@ -13,3 +13,7 @@ commands:
|
||||
description: Broadcasts a message to the specified Discord channel.
|
||||
usage: /<command> <channel> <msg>
|
||||
aliases: [dbroadcast, dbc, dbcast, ediscordbroadcast, edbroadcast, edbc, edbcast]
|
||||
discord:
|
||||
description: Sends the discord invite link to the player.
|
||||
usage: /<command>
|
||||
aliases: [ediscord]
|
Loading…
Reference in New Issue
Block a user