Added /discord

This commit is contained in:
5vl 2021-01-12 14:44:43 +01:00
parent 081bbb9393
commit 8cd662280c
4 changed files with 28 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package coreplugin.coreplugin; package coreplugin.coreplugin;
import coreplugin.coreplugin.commands.discord;
import coreplugin.coreplugin.commands.fly; import coreplugin.coreplugin.commands.fly;
import coreplugin.coreplugin.commands.gamemodes.GMA; import coreplugin.coreplugin.commands.gamemodes.GMA;
import coreplugin.coreplugin.commands.gamemodes.GMC; import coreplugin.coreplugin.commands.gamemodes.GMC;
@ -16,7 +17,7 @@ public final class Core extends JavaPlugin {
private static Core instance; private static Core instance;
@Override @Override
public void onEnable() { public void onEnable() {
System.out.println("Core Plugin has been enabled."); System.out.println("Enabed Core Plugin 1.0.0");
instance = this; instance = this;
this.getConfig().options().copyDefaults(); this.getConfig().options().copyDefaults();
saveDefaultConfig(); saveDefaultConfig();
@ -36,5 +37,6 @@ public final class Core extends JavaPlugin {
getCommand("kick").setExecutor(new kick()); getCommand("kick").setExecutor(new kick());
getCommand("ban").setExecutor(new ban()); getCommand("ban").setExecutor(new ban());
getCommand("unban").setExecutor(new unban()); getCommand("unban").setExecutor(new unban());
getCommand("discord").setExecutor(new discord());
} }
} }

View File

@ -0,0 +1,21 @@
package coreplugin.coreplugin.commands;
import coreplugin.coreplugin.Core;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class discord implements CommandExecutor {
private String color(String string) {
return ChatColor.translateAlternateColorCodes('&', string);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
String Discord = Core.getInstance().getConfig().getString("Discord");
Player p = (Player) sender;
p.sendMessage(color(Discord));
return false;
}
}

View File

@ -43,3 +43,4 @@ CannotFindPlayer: '&4Error: Cannot find the specified player.'
MissingPermission: '&4&lYou do not have permission to execute this command!' MissingPermission: '&4&lYou do not have permission to execute this command!'
Console: '&cYou can only run this command as a player.' Console: '&cYou can only run this command as a player.'
InvalidArgument: '&4Error: Invalid argument.' InvalidArgument: '&4Error: Invalid argument.'
Discord: '&bhttps://discord.gg/YourDiscordLinkHere' # Please put in your discord link.

View File

@ -22,4 +22,6 @@ commands:
ban: ban:
description: You can ban people with this! description: You can ban people with this!
unban: unban:
description: You can unban people with this! description: You can unban people with this!
discord:
description: Send your discord link in chat!