map parser update
This commit is contained in:
parent
19208de075
commit
290e4d69df
@ -66,7 +66,7 @@ import mineplex.mapparser.command.HubCommand;
|
||||
import mineplex.mapparser.command.ListCommand;
|
||||
import mineplex.mapparser.command.MapCommand;
|
||||
import mineplex.mapparser.command.NameCommand;
|
||||
import mineplex.mapparser.command.ParseCommand;
|
||||
import mineplex.mapparser.command.ParseCommand600;
|
||||
import mineplex.mapparser.command.RenameCommand;
|
||||
import mineplex.mapparser.command.SaveCommand;
|
||||
import mineplex.mapparser.command.WorldsCommand;
|
||||
@ -106,7 +106,7 @@ public class MapParser extends JavaPlugin implements Listener
|
||||
_commands.add(new ListCommand(this));
|
||||
_commands.add(new MapCommand(this));
|
||||
_commands.add(new NameCommand(this));
|
||||
_commands.add(new ParseCommand(this));
|
||||
_commands.add(new ParseCommand600(this));
|
||||
_commands.add(new RenameCommand(this));
|
||||
_commands.add(new SaveCommand(this));
|
||||
_commands.add(new WorldsCommand(this));
|
||||
|
@ -46,7 +46,7 @@ public class Parse
|
||||
|
||||
private int _processed = 0;
|
||||
|
||||
public Parse(MapParser host, World world, String[] args, Location loc, MapData data)
|
||||
public Parse(MapParser host, World world, String[] args, Location loc, MapData data, int size)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
@ -56,6 +56,8 @@ public class Parse
|
||||
|
||||
_mapData = data;
|
||||
|
||||
_size = size;
|
||||
|
||||
for (String arg : args)
|
||||
Host.Announce("Parse Arg: " + F.elem(arg));
|
||||
|
||||
|
@ -12,11 +12,11 @@ import mineplex.mapparser.Parse;
|
||||
/**
|
||||
* Created by Shaun on 8/15/2014.
|
||||
*/
|
||||
public class ParseCommand extends BaseCommand
|
||||
public class ParseCommand200 extends BaseCommand
|
||||
{
|
||||
public ParseCommand(MapParser plugin)
|
||||
public ParseCommand200(MapParser plugin)
|
||||
{
|
||||
super(plugin, "parse");
|
||||
super(plugin, "parse200");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -57,7 +57,7 @@ public class ParseCommand extends BaseCommand
|
||||
}
|
||||
|
||||
//Parse the World
|
||||
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName())));
|
||||
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 200));
|
||||
|
||||
return true;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.Parse;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/15/2014.
|
||||
*/
|
||||
public class ParseCommand400 extends BaseCommand
|
||||
{
|
||||
public ParseCommand400(MapParser plugin)
|
||||
{
|
||||
super(plugin, "parse400");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
if (!player.isOp())
|
||||
{
|
||||
message(player, "Only OPs can parse maps!");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location parseLoc = player.getLocation();
|
||||
|
||||
World world = parseLoc.getWorld();
|
||||
|
||||
MapData data = getPlugin().GetData(world.getName());
|
||||
|
||||
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
|
||||
{
|
||||
message(player, "Map Name/Author/GameType are not set!");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Teleport Players Out
|
||||
for (Player worldPlayer : world.getPlayers())
|
||||
{
|
||||
worldPlayer.teleport(getPlugin().getSpawnLocation());
|
||||
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
|
||||
}
|
||||
|
||||
//Unload World > Copy
|
||||
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
|
||||
|
||||
if (parseableWorld == null)
|
||||
{
|
||||
message(player, "Could not prepare world for parsing!");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Parse the World
|
||||
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 400));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package mineplex.mapparser.command;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.mapparser.MapData;
|
||||
import mineplex.mapparser.MapParser;
|
||||
import mineplex.mapparser.Parse;
|
||||
|
||||
/**
|
||||
* Created by Shaun on 8/15/2014.
|
||||
*/
|
||||
public class ParseCommand600 extends BaseCommand
|
||||
{
|
||||
public ParseCommand600(MapParser plugin)
|
||||
{
|
||||
super(plugin, "parse","parse600");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(Player player, String alias, String[] args)
|
||||
{
|
||||
if (!player.isOp())
|
||||
{
|
||||
message(player, "Only OPs can parse maps!");
|
||||
return true;
|
||||
}
|
||||
|
||||
Location parseLoc = player.getLocation();
|
||||
|
||||
World world = parseLoc.getWorld();
|
||||
|
||||
MapData data = getPlugin().GetData(world.getName());
|
||||
|
||||
if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null"))
|
||||
{
|
||||
message(player, "Map Name/Author/GameType are not set!");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Teleport Players Out
|
||||
for (Player worldPlayer : world.getPlayers())
|
||||
{
|
||||
worldPlayer.teleport(getPlugin().getSpawnLocation());
|
||||
message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed.");
|
||||
}
|
||||
|
||||
//Unload World > Copy
|
||||
World parseableWorld = getPlugin().getWorldManager().prepMapParse(world);
|
||||
|
||||
if (parseableWorld == null)
|
||||
{
|
||||
message(player, "Could not prepare world for parsing!");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Parse the World
|
||||
getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().GetData(parseLoc.getWorld().getName()), 600));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user