Package org.mctourney.autoreferee

Examples of org.mctourney.autoreferee.AutoRefMap$MapLoader


      && !sender.hasPermission("autoreferee.admin")) return false;

    String name = match.getMapName();
    if (args.length > 0) name = StringUtils.join(args, ' ');

    AutoRefMap map = AutoRefMap.getMap(name);
    if (map == null)
    {
      sender.sendMessage(ChatColor.DARK_GRAY +
        "No archive of this map exists " + name);
      return true;
    }

    sender.sendMessage(ChatColor.DARK_GRAY +
      "Preparing a new copy of " + map.getVersionString());
    AutoRefMatch newmatch = AutoRefMap.createMatch(map, null);

    if (map.equals(match.getMap()) && options.hasOption('x'))
    {
      newmatch.setStartTime(match.getStartTime());
      newmatch.setCurrentState(match.getCurrentState());

      for (Player p : match.getWorld().getPlayers())
View Full Code Here


  public boolean configApply(CommandSender sender, AutoRefMatch match, String[] args, CommandLine options)
  {
    // generate a map name from the args
    String mapName = StringUtils.join(args, " ");
    AutoRefMap map = AutoRefMap.getMap(mapName);
    World world = plugin.getSenderWorld(sender);

    if (map == null)
    {
      sender.sendMessage(ChatColor.RED + "Unknown map: " + mapName);
      return true;
    }
    else sender.sendMessage(ChatColor.RED + "Applying " + map.getVersionString());

    Element worldConfig = null;
    try { worldConfig = AutoRefMap.getConfigFileData(map.getZip()); }
    catch (IOException e) { e.printStackTrace(); return true; }
    catch (JDOMException e) { e.printStackTrace(); return true; }

    // set a new version string if one is specified
    if (options.hasOption('v'))
View Full Code Here

            (lines[3].trim().startsWith("[") && lines[3].trim().endsWith("]"));

          String mapname = lines[1] + " " + lines[2];
          if (!hasVersion) mapname += " " + lines[3];

          AutoRefMap map = AutoRefMap.getMap(mapname.trim());
          if (map != null)
          {
            if (player.isSneaking()) map.install();
            else this.lobbyLoadMap(player, map);

            // if the sign is fit to have a version string listed, add/update it
            if (hasVersion && map.getVersion().length() <= 13)
            {
              sign.setLine(3, String.format("[v%s]", map.getVersion()));
              sign.update();
            }
          }
        }
      }
View Full Code Here

    try
    {
      // loop through the map names in the rotation file to add to the list
      for (String mapname : FileUtils.readLines(ROTATION_FILE, "UTF-8"))
      {
        AutoRefMap map = AutoRefMap.getMap(mapname);
        if (map != null) rotation.add(map);
      }

      // shuffle the rotation
      Collections.shuffle(rotation);
View Full Code Here

  {
    // load up the map with a recognizable name
    this.currentMatchName = String.format("world-autoref-R%04d-%x",
      rotationCounter, System.currentTimeMillis());

    AutoRefMap map = getNextMap(); ++rotationCounter;
    AutoRefMap.loadMap(Bukkit.getConsoleSender(), map, this.currentMatchName);
    return map;
  }
View Full Code Here

  public boolean nextMap(CommandSender sender, AutoRefMatch match, String[] args, CommandLine options)
  {
    if (match != this.currentMatch) return false;

    AutoRefMap map = getNextMap();
    sender.sendMessage(ChatColor.GREEN + "Next map is " + map.getVersionString());
    return true;
  }
View Full Code Here

  {
    // if this is the current match in the rotation, defer unloading
    // until we load the next match and move everyone there
    if (event.getMatch() == this.currentMatch)
    {
      AutoRefMap map = loadNextMap();
      currentMatch.broadcast(ChatColor.GREEN + "Now loading: " +
        ChatColor.RESET + map.getVersionString());
      event.setCancelled(true);
    }
  }
View Full Code Here

TOP

Related Classes of org.mctourney.autoreferee.AutoRefMap$MapLoader

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.