Advertisement
Guest User

Untitled

a guest
Sep 19th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. package me.core.spazzolino.Commands;
  2.  
  3. import org.bukkit.command.Command;
  4. import org.bukkit.command.CommandExecutor;
  5. import org.bukkit.command.CommandSender;
  6. import org.bukkit.configuration.file.FileConfiguration;
  7. import org.bukkit.entity.Player;
  8.  
  9. import me.core.spazzolino.main;
  10.  
  11. public class FlyCommand
  12. implements CommandExecutor
  13. {
  14.  
  15. FileConfiguration config = main.plugin.getConfig();
  16.  
  17. public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args){
  18. if(cmd.getName().equalsIgnoreCase("fly")){
  19. Player p = (Player)sender;
  20.  
  21. if (!(sender instanceof Player)){
  22. sender.sendMessage("Only players may use this command!");
  23. return true;
  24. }
  25. if(p.getAllowFlight() == false) {
  26. p.sendMessage(config.getString("CommandOptions.Fly.enable").replaceAll("&", "ยง").toString());
  27. p.setAllowFlight(true);
  28. return true;
  29. }
  30. p.setAllowFlight(false);
  31. p.sendMessage(config.getString("CommandOptions.Fly.disable").replaceAll("&", "ยง").toString());
  32. return true;
  33.  
  34. }
  35. return true;
  36.  
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement