Guest User

Untitled

a guest
Mar 28th, 2020
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String worldName = event.getPlayer().getLocation().getWorld();
  2. Location l = event.getPlayer().getLocation().clone();
  3. l.setY(0); //For having cylinder instead of sphere
  4. int radius = -1;
  5. if(cfg.contains("megachat.radiusworlds."+worldName))
  6.     radius = cfg.getInt("megachat.radiusworlds."+worldName);
  7. for(Player p : Bukkit.getOnlinePlayers()) {
  8.     Location l2 = p.getLocation().clone();
  9.     l2.setY(0);
  10.     boolean pass = true;
  11.     if(radius >= 0 && l.distance(l2) > radius) pass = false;
  12.     if(pass) {
  13.         //sending message
  14.     }
  15. }
RAW Paste Data