Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mohid.besocial;
- 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 {
- Main plugin;
- public Discord(Main plugin) {
- super();
- this.plugin = plugin;
- }
- public String discord;
- public String noperm;
- public String disabled;
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (sender instanceof Player) {
- if (cmd.getName().equalsIgnoreCase("discord")) {
- Player p = (Player) sender;
- discord = Messages.get().getString("discord-msg");
- noperm = Messages.get().getString("no-permission");
- disabled = Messages.get().getString("cmd-disabled");
- if (p.hasPermission("bescocial.discord")) {
- if (plugin.getConfig().getBoolean("discord")) {
- p.sendMessage(discord.replaceAll("&", "§"));
- } else {
- p.sendMessage(disabled.replaceAll("&", "§"));
- return true;
- }
- } else {
- p.sendMessage(noperm.replaceAll("&", "§"));
- return true;
- }
- }
- } else {
- sender.sendMessage("this is a player command");
- return true;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement