Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package netcore.netcore.commands;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import java.util.ArrayList;
- public class FlyCommand implements CommandExecutor {
- private ArrayList<Player> list_of_flying_players = new ArrayList<>();
- @Override
- public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
- if (args.length == 0){
- if (sender instanceof Player){
- Player player = (Player) sender;
- if(player.hasPermission("netcore.fly"));
- if (list_of_flying_players.contains(player)){
- list_of_flying_players.remove(player);
- player.setAllowFlight(false);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned " + ChatColor.RED + "off!");
- }else if (!list_of_flying_players.contains(player)) {
- list_of_flying_players.add(player);
- player.setAllowFlight(true);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned on!");
- }
- }
- }else if (args.length == 1){
- Player target = Bukkit.getPlayer(args[0]);
- if (sender instanceof Player){
- Player player = (Player) sender;
- if(player.hasPermission("netcore.fly"));
- if (list_of_flying_players.contains(player)){
- list_of_flying_players.remove(player);
- player.setAllowFlight(false);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned " + ChatColor.RED + "off!");
- }else if (!list_of_flying_players.contains(player)) {
- list_of_flying_players.add(player);
- player.setAllowFlight(true);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned on!");
- }
- }
- }
- return true;
- }
- private void Flymethod(Player player){
- if (sender instanceof Player){
- player = (Player) sender;
- if(player.hasPermission("netcore.fly"));
- if (list_of_flying_players.contains(player)){
- list_of_flying_players.remove(player);
- player.setAllowFlight(false);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned " + ChatColor.RED + "off!");
- }else if (!list_of_flying_players.contains(player)) {
- list_of_flying_players.add(player);
- player.setAllowFlight(true);
- player.sendMessage(ChatColor.GREEN + "NetCore: " + ChatColor.WHITE + "Flight is turned on!");
- }
- } }
- }
Advertisement
Add Comment
Please, Sign In to add comment