Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefSpectator


  public boolean nightVision(CommandSender sender, AutoRefMatch match, String[] args, CommandLine options)
  {
    if (match != null)
    {
      AutoRefSpectator spectator = match.getSpectator((Player) sender);

      if (spectator.hasNightVision() && !options.hasOption('x'))
        sender.sendMessage(ChatColor.GREEN + "Use '/ar nightvis -x' to disable night vision.");
      else spectator.setNightVision(!options.hasOption('x'));
    }
    return match != null;
  }
View Full Code Here


      else player = target;
    }

    if (match != null && player != null)
    {
      AutoRefSpectator spectator = match.getSpectator(player);
      if (spectator == null) return false;

      if (spectator.isStreamer() && !options.hasOption('x'))
        sender.sendMessage(ChatColor.RED + "Use '/ar streamer -x' to disable streaming mode.");
      else spectator.setStreamer(!options.hasOption('x'));

      if (player != sender)
      {
        String enabled = spectator.isStreamer() ? "Enabled" : "Disabled";
        sender.sendMessage(ChatColor.GREEN + enabled + " streamer mode for " + player.getName());
      }
    }
    return match != null;
  }
View Full Code Here

    World world = player.getWorld();

    AutoRefMatch match = plugin.getMatch(world);
    if (match == null || !match.isSpectator(player)) return;

    AutoRefSpectator spec = match.getSpectator(player);
    boolean pvis = spec.isInvisible();

    double bdistance = Double.MAX_VALUE;
    for (AutoRefPlayer apl : match.getPlayers()) if (apl.isOnline())
    {
      Location ploc = apl.getPlayer().getLocation();
      double dist = ploc.distanceSquared(player.getLocation());
      if (dist < bdistance) { bdistance = dist; }
    }

    // if the spectator should be invisible, change visibility and then redo visibility
    boolean vis = bdistance <= SPECTATOR_VISIBILITY_RADIUS * SPECTATOR_VISIBILITY_RADIUS;
    spec.setInvisible(vis);

    // if the visibility status has changed, reconfigure
    if (pvis != vis) match.setupVisibility(player);
  }
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefSpectator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.