package com.encrox.instanceddungeons; import java.io.File; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.plugin.Plugin; import org.json.JSONArray; import org.json.JSONObject; import com.encrox.instancedregions.InstancedProtectedCuboidRegion; import com.sk89q.worldedit.BlockVector; public class Section { private Schematic schematic; private String schematicFileName; private Map exitMap; private ArrayList players; private BlockVector[] exits; private BlockVector size; private int index, depth; private InstancedProtectedCuboidRegion region; private Listener moveOutOfLoadingZoneListener, moveIntoLoadingZoneListener; private volatile boolean justEntered, portal; public Section(JSONObject descriptor, int index, int depth) { this.index = index; this.depth = depth; players = new ArrayList(); schematicFileName = descriptor.getString("file"); JSONArray size = descriptor.getJSONArray("size"); this.size = new BlockVector(size.getInt(0), size.getInt(1), size.getInt(2)); JSONArray exits = descriptor.getJSONArray("exits"); this.exits = new BlockVector[exits.length()]; for(int i = 0; i(); this.schematic = new Schematic(new File(InstancedDungeons.schematicsDirectory, schematicFileName)); if(index <= depth) { Section next; ArrayList
usable = new ArrayList
(); for(int i = 0; i sections = exitMap.values().iterator(); while(sections.hasNext()) sections.next().addPlayer(player); } } public void removePlayer(Player player) { players.add(player); if(region != null) region.removePlayer(player); if(exitMap != null) { Iterator
sections = exitMap.values().iterator(); while(sections.hasNext()) sections.next().removePlayer(player); } } }