Examples of AutoRefTeam


Examples of org.mctourney.autoreferee.AutoRefTeam

    }

    Set<AutoRefTeam> teams = Sets.newHashSet();
    for (String arg : args)
    {
      AutoRefTeam team = match.getTeam(arg);
      if (team != null) teams.add(team);
    }

    boolean isStartRegion = options.hasOption('S');
    if (teams.isEmpty() && !isStartRegion)
    {
      // team name is invalid. let the player know
      sender.sendMessage(ChatColor.DARK_GRAY + "No valid team names given.");
      sender.sendMessage("Teams are " + match.getTeamList());
      return true;
    }

    Selection sel = worldEdit.getSelection(player);
    AutoRefRegion reg = null;

    if ((sel instanceof CuboidSelection))
    {
      CuboidSelection csel = (CuboidSelection) sel;
      reg = new CuboidRegion(csel.getMinimumPoint(), csel.getMaximumPoint());
    }

    // if we couldn't get a region from WorldEdit
    if (reg == null) return false;

    // add the selection to the start regions
    if (isStartRegion)
    {
      match.addStartRegion(reg);
      sender.sendMessage("Region now marked as a start region!");
      return true;
    }

    // name this region if it has a name
    if (options.hasOption('N'))
      reg.setName(options.getOptionValue('N', null));

    for (AutoRefRegion.Flag flag : AutoRefRegion.Flag.values())
      if (options.hasOption(flag.getMark())) reg.toggle(flag);
    for (AutoRefTeam team : teams) if (team.addRegion(reg))
      sender.sendMessage(reg.toString() + " set as " + team.getDisplayName() + "'s region.");
    return true;
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

      // world edit not installed
      sender.sendMessage("This method requires WorldEdit installed and running.");
      return true;
    }

    AutoRefTeam team = match.getTeam(args[0]);
    Selection sel = worldEdit.getSelection(player);
    AutoRefRegion reg = null;

    if ((sel instanceof CuboidSelection))
    {
      CuboidSelection csel = (CuboidSelection) sel;
      reg = new CuboidRegion(csel.getMinimumPoint(), csel.getMaximumPoint());
    }
    else
    {
      sender.sendMessage("You must have a selection with WorldEdit already to run this method.");
      return true;
    }

    CoreGoal core = new CoreGoal(team, reg);
    if (options.hasOption('r'))
      try { core.setRange(Long.parseLong(options.getOptionValue('r'))); }
      catch (NumberFormatException e)
      { sender.sendMessage(ChatColor.RED + options.getOptionValue('r') + " is not a valid range."); }

    team.addGoal(core);
    sender.sendMessage(reg.toString() + " set as " + team.getDisplayName() + "'s TARGET core.");
    sender.sendMessage(team.getDisplayName() + " will be attacking this core, not defending it.");
    return true;
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

  public void setName(String name)
  { this.regionName = name; }

  public void announceRegion(AutoRefPlayer apl)
  {
    AutoRefTeam team = apl.getTeam();
    if (this.regionName == null || !owners.contains(team)) return;

    Long last = lastNotification.get(team);
    long ctime = ManagementFactory.getRuntimeMXBean().getUptime();

    if (last == null || ctime - last > NOTIFICATION_THRESHOLD_MS)
    {
      String msg = apl.getDisplayName() + " has entered " +
        team.getColor() + ChatColor.BOLD + this.getName();
      AutoReferee.log(msg);
      for (Player ref : apl.getMatch().getReferees(false)) ref.sendMessage(msg);
      lastNotification.put(team, ctime);
    }
  }
View Full Code Here

Examples of org.mctourney.autoreferee.AutoRefTeam

  }

  @EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled=true)
  public void teamJoin(PlayerTeamJoinEvent event)
  {
    AutoRefTeam team = event.getTeam();
    if (team.getPlayers().size() >= team.getMaxSize())
      event.setCancelled(true);

    // schedule a check to see if we need to start the match
    if (team.getMatch().getCurrentState().isBeforeMatch())
      new MatchStarterTask(team.getMatch()).runTask(plugin);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.