I'm trying to code a bukkit 1.8.8 plugin that basically allows someone to type a command composing of 2 parts. The first part is the player to be bubbled, the 2nd part is the radius of the bubble. It would look like /bubble . I basically want anyone who walks within that radius to get shot out very far. I really have no idea how to do this. The main part i'm stuck on is setting a radius around the player, and getting players who enter it. Please help me!!
code:
package me.Glowhoo.EpicUtil;
import java.util.Arrays;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Bubble implements CommandExecutor {
private Main plugin;
public Bubble(Main plugin)
{
this.plugin = plugin;
}
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (cmd.getName().equalsIgnoreCase("bubble"))
{
if (sender instanceof Player)
{
if (args.length > 0 && args.length < 2)
{
if (Bukkit.getPlayer(args[0]) != null)
{
Player victim = (Bukkit.getPlayer(args[0]));
Bukkit.broadcastMessage(ChatColor.BOLD.GREEN + victim.getName() + ChatColor.BOLD.DARK_GRAY + " Is now in a bubble!");
}
else
{
sender.sendMessage(ChatColor.RED + "Player is not online!");
}
}
else
{
sender.sendMessage(ChatColor.RED + "Invalid arguments!");
}
}
else
{
sender.sendMessage(ChatColor.AQUA + "The console cannot bubble someone!");
}
}
return false;
}
}
This code is just what I have been messing with. Any more efficient methods would be appreciated. THANKS :D
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire