Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.DreamBios.Near;
- import java.util.ArrayList;
- import java.util.List;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Near extends JavaPlugin {
- public String Prefix = "&8[&7Arkoricraft&8] &7";
- public void onEnable() {
- getCommand("acnear").setExecutor(this);
- getConfig().options().copyDefaults(true);
- saveConfig();
- }
- public String c(String input)
- {
- return ChatColor.translateAlternateColorCodes('&', input);
- }
- public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
- if (sender instanceof Player)
- {
- Player p = (Player) sender;
- if (p.hasPermission("ArkoricraftNearby.use"))
- {
- List<String> distance = new ArrayList<String>();
- for (Player target : Bukkit.getOnlinePlayers())
- {
- if (!target.getName().equalsIgnoreCase(p.getName()) && p.getWorld().getName().equalsIgnoreCase(target.getWorld().getName()))
- {
- if ((int) target.getLocation().distance(p.getLocation()) <= getConfig().getInt("Distance"))
- {
- if (target.hasPermission("Arkoricraft.hidden"))
- {
- if (p.hasPermission("Arkoricraft.hidden.bypass"))
- {
- distance.add("&7[H] " + target.getName() + " &6(&e" + (int) target.getLocation().distance(p.getLocation()) + "&6)");
- }
- } else {
- distance.add("&e" + target.getName() + " &6(&e" + (int) target.getLocation().distance(p.getLocation()) + "&6)");
- }
- }
- }
- }
- if (distance.size() == 0)
- {
- p.sendMessage(c(Prefix + "&ePersonne n'est dans les &6" + getConfig().getInt("Distance") + "&e blocs"));
- } else {
- String string = "";
- int Count = 0;
- for (String d2 : distance)
- {
- Count ++;
- if (Count == distance.size())
- {
- string = string + d2;
- } else {
- string = string + d2 + "&8, ";
- }
- }
- p.sendMessage(c(""));
- p.sendMessage(c(Prefix + "&bJoueurs:"));
- p.sendMessage(c(Prefix + string));
- }
- return true;
- } else {
- p.sendMessage(c(Prefix + "&cTu ne peux pas faire cette commande"));
- return true;
- }
- } else {
- sender.sendMessage("T'as cru tu pouvais faire ca dans la console Oo");
- return true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement