if ("tp".equalsIgnoreCase(parts[0]))
{
Location loc = null;
if ("player".equalsIgnoreCase(parts[1]))
{
AutoRefPlayer apl = match.getPlayer(parts[2]);
if (apl != null)
{
if ("player".equalsIgnoreCase(parts[3])) loc = apl.getLocation();
else if ("death".equalsIgnoreCase(parts[3])) loc = apl.getLastDeathLocation();
else if ("spawn".equalsIgnoreCase(parts[3])) loc = apl.getBedLocation();
}
}
else if ("team".equalsIgnoreCase(parts[1]))
{
AutoRefTeam team = match.getTeam(parts[2]);
if (team != null)
{
if ("vm".equalsIgnoreCase(parts[3])) loc = team.getVictoryMonumentLocation();
else if ("spawn".equalsIgnoreCase(parts[3])) loc = team.getSpawnLocation();
}
}
// teleport to the location, if any
loc = TeleportationUtil.locationTeleport(loc);
if (loc == null) player.sendMessage(ChatColor.DARK_GRAY +
"You cannot teleport to this location: invalid or unsafe.");
else
{
match.getSpectator(player).setPrevLocation(player.getLocation());
player.teleport(loc); player.setFlying(true);
}
}
else if ("inventory".equalsIgnoreCase(parts[0]))
{
if ("player".equalsIgnoreCase(parts[1]))
{
AutoRefPlayer apl = match.getPlayer(parts[2]);
boolean old = parts.length > 3 && "prev".equalsIgnoreCase(parts[3]);
// if we are unable to show the inventory, tell the streamer that
if (apl == null || !apl.showInventory(player, old))
player.sendMessage(ChatColor.DARK_GRAY + "Cannot show inventory for " + parts[2]);
}
}
}
catch (UnsupportedEncodingException e)