package me.StevenLawson.TotalFreedomMod.Commands; import java.util.List; import me.StevenLawson.TotalFreedomMod.TFM_UserInfo; import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.util.Vector; public class Command_orbit extends TFM_Command { @Override public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (senderIsConsole || TFM_Util.isUserSuperadmin(sender, plugin)) { if (args.length == 0) { return false; } Player p; List matches = Bukkit.matchPlayer(args[0]); if (matches.isEmpty()) { sender.sendMessage(ChatColor.GRAY + "Can't find user " + args[0]); return true; } else { p = matches.get(0); } TFM_UserInfo playerdata = TFM_UserInfo.getPlayerData(p, plugin); double strength = 10.0; if (args.length >= 2) { if (args[1].equalsIgnoreCase("stop") || args[1].equalsIgnoreCase("end")) { sender.sendMessage(ChatColor.GRAY + "Stopped orbiting " + p.getName()); playerdata.stopOrbiting(); return true; } try { strength = Double.parseDouble(args[1]); } catch (NumberFormatException nfex) { strength = 10.0; } } p.setGameMode(GameMode.SURVIVAL); playerdata.startOrbiting(strength); p.setVelocity(new Vector(0, strength, 0)); sender.sendMessage(ChatColor.GRAY + "Orbiting " + p.getName()); } else { sender.sendMessage(TotalFreedomMod.MSG_NO_PERMS); } return true; } }