Advertisement
DeathMater

Untitled

Apr 19th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. public class PlayerJoin implements Listener {
  2.  
  3.  
  4. @SuppressWarnings("deprecation")
  5. @EventHandler
  6. public void onPlayerJoin(PlayerJoinEvent e) {
  7. Player p = e.getPlayer();
  8.  
  9. if(EssentialsCommand.flyPlayer.contains(p)) {
  10. p.setAllowFlight(true);
  11. p.sendMessage("fly");
  12.  
  13. }else {
  14. p.sendMessage(EssentialsCommand.flyPlayer.toString());
  15. }
  16. }
  17. }
  18.  
  19.  
  20. public class EssentialsCommand implements CommandExecutor {
  21.  
  22. public static List<Player> flyPlayer = new ArrayList<>();
  23. public static List<Player> vanishPlayer = new ArrayList<>();
  24.  
  25. public EssentialsCommand(Main plugin) {
  26. this.plugin = plugin;
  27. }
  28.  
  29. @SuppressWarnings("deprecation")
  30. @Override
  31. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  32. Player p = (Player) sender;
  33. if(cmd.getName().equalsIgnoreCase("fly")) {
  34. if(args.length == 0) {
  35. if(p.hasPermission("essentials.fly")) {
  36. if(flyPlayer.contains(p)) {
  37. p.setAllowFlight(false);
  38. flyPlayer.remove(p);
  39. p.sendMessage(plugin.prefix + "§dDu kannst nicht mehr fliegen!");
  40. }else {
  41. p.setAllowFlight(true);
  42. flyPlayer.add(p);
  43. p.sendMessage(plugin.prefix + "§dDu kannst fliegen!");
  44.  
  45. }
  46. }else {
  47. noPermssion(p);
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement