Advertisement
Guest User

Test

a guest
Jun 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. package com.mohid.besocial;
  2.  
  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandExecutor;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.entity.Player;
  7.  
  8. public class Discord implements CommandExecutor {
  9.  
  10. Main plugin;
  11.  
  12. public Discord(Main plugin) {
  13. super();
  14. this.plugin = plugin;
  15. }
  16.  
  17. public String discord;
  18. public String noperm;
  19. public String disabled;
  20.  
  21. @Override
  22. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  23. if (sender instanceof Player) {
  24. if (cmd.getName().equalsIgnoreCase("discord")) {
  25. Player p = (Player) sender;
  26. discord = Messages.get().getString("discord-msg");
  27. noperm = Messages.get().getString("no-permission");
  28. disabled = Messages.get().getString("cmd-disabled");
  29. if (p.hasPermission("bescocial.discord")) {
  30. if (plugin.getConfig().getBoolean("discord")) {
  31. p.sendMessage(discord.replaceAll("&", "§"));
  32.  
  33. } else {
  34. p.sendMessage(disabled.replaceAll("&", "§"));
  35. return true;
  36. }
  37. } else {
  38. p.sendMessage(noperm.replaceAll("&", "§"));
  39. return true;
  40. }
  41. }
  42. } else {
  43. sender.sendMessage("this is a player command");
  44. return true;
  45. }
  46.  
  47. return true;
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement