Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. package me.AlexandruSAN.CheckFly.commands;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.command.Command;
  5. import org.bukkit.command.CommandExecutor;
  6. import org.bukkit.command.CommandSender;
  7. import org.bukkit.entity.Player;
  8. import org.bukkit.plugin.java.JavaPlugin;
  9.  
  10. import me.AlexandruSAN.CheckFly.Utils.Utils;
  11.  
  12. public class CheckFly implements CommandExecutor {
  13.  
  14. JavaPlugin plugin = this.plugin;
  15.  
  16. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  17. if (!(sender instanceof Player)) {
  18. sender.sendMessage(Utils.chat(plugin.getConfig().getString("console_error_message")));
  19. return true;
  20.  
  21. }
  22.  
  23. Player p = (Player) sender;
  24.  
  25. if (!sender.hasPermission("checkfly.use")) {
  26. p.sendMessage(Utils.chat(plugin.getConfig().getString("player_no_permission")));
  27.  
  28. return true;
  29. }
  30.  
  31. if (sender.hasPermission("checkfly.reload")) {
  32. if (args[0].equalsIgnoreCase("reload")) {
  33. if (Bukkit.getOnlinePlayers().contains(args[0])) {
  34. plugin.reloadConfig();
  35. } else {
  36. Player target = Bukkit.getPlayer(args[0]);
  37.  
  38. if (sender.hasPermission("checkfly.use")) {
  39.  
  40. } else {
  41. if (Bukkit.getOnlinePlayers().contains(args[0])) {
  42. if (target.isFlying()) {
  43. p.sendMessage(Utils.chat(plugin.getConfig().getString("player_fly")));
  44. } else {
  45. p.sendMessage(Utils.chat(plugin.getConfig().getString("player_not_fly")));
  46. }
  47. } else {
  48. p.sendMessage(Utils.chat(plugin.getConfig().getString("player_no_exist")));
  49.  
  50. if (sender.hasPermission("checkfly.reload")) {
  51. if (args.length == 0) {
  52. sender.sendMessage(Utils.chat(plugin.getConfig().getString("reload_use_command")));
  53. return true;
  54. }
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
  61. return false;
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement