// Path: src/main/java/com/winterhavenmc/deathchest/PluginMain.java
// public final class PluginMain extends JavaPlugin {
// 
// 	public MessageBuilder<MessageId, Macro> messageBuilder;
// 	public WorldManager worldManager;
// 	public SoundConfiguration soundConfig;
// 	public ChestManager chestManager;
// 	public CommandManager commandManager;
// 	public ProtectionPluginRegistry protectionPluginRegistry;
// 
// 
// 	@Override
// 	public void onEnable() {
// 
// 		// bStats
// 		new Metrics(this, 13916);
// 
// 		// copy default config from jar if it doesn't exist
// 		saveDefaultConfig();
// 
// 		// initialize message builder
// 		messageBuilder = new MessageBuilder<>(this);
// 
// 		// instantiate sound configuration
// 		soundConfig = new YamlSoundConfiguration(this);
// 
// 		// instantiate world manager
// 		worldManager = new WorldManager(this);
// 
// 		// instantiate chest manager
// 		chestManager = new ChestManager(this);
// 
// 		// load all chests from datastore
// 		chestManager.loadChests();
// 
// 		// instantiate command manager
// 		commandManager = new CommandManager(this);
// 
// 		// initialize event listeners
// 		new PlayerEventListener(this);
// 		new BlockEventListener(this);
// 		new InventoryEventListener(this);
// 
// 		// instantiate protection plugin registry
// 		protectionPluginRegistry = new ProtectionPluginRegistry(this);
// 	}
// 
// 
// 	@Override
// 	public void onDisable() {
// 
// 		// close datastore
// 		chestManager.closeDataStore();
// 	}
// 
// }
// 
// Path: src/main/java/com/winterhavenmc/deathchest/chests/ChestSize.java
// public enum ChestSize {
// 
// 	SINGLE(27),
// 	DOUBLE(54);
// 
// 	private final int size;
// 
// 
// 	/**
// 	 * Constructor
// 	 *
// 	 * @param size the chest inventory size
// 	 */
// 	ChestSize(final int size) {
// 		this.size = size;
// 	}
// 
// 
// 	/**
// 	 * Determine chest size required for a given inventory size
// 	 *
// 	 * @param itemCount the number of ItemStacks to be considered for chest size
// 	 * @return ChestSize enum value, SINGLE or DOUBLE
// 	 */
// 	public static ChestSize selectFor(final int itemCount) {
// 
// 		if (itemCount > SINGLE.size) {
// 			return DOUBLE;
// 		}
// 		return SINGLE;
// 	}
// 
// }


import com.winterhavenmc.deathchest.PluginMain;
import com.winterhavenmc.deathchest.chests.ChestSize;
import org.bukkit.Location;
import org.bukkit.entity.Player;
/*
 * Copyright (c) 2022 Tim Savage.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

package com.winterhavenmc.deathchest.chests.search;



/**
 * A class that implements a search strategy for a valid chest location
 */
public final class QuadrantSearch extends AbstractSearch {


	/**
	 * An enum that implements a cartesian quadrant system, where each member defines the sign of the x and z coordinates
	 */
	private enum Quadrant {
		I(1,1),
		II(-1,1),
		III(-1,-1),
		IV(1,-1);

		final int xFactor;
		final int zFactor;


		/**
		 * Constructor for the Quadrant enum
		 * @param xFactor the x multiplier to achieve negative or positive sign for the quadrant member
		 * @param zFactor the z multiplier to achieve negative or positive sign for the quadrant member
		 */
		Quadrant(final int xFactor, final int zFactor) {

			this.xFactor = xFactor;
			this.zFactor = zFactor;
		}
	}


	/**
	 * Class constructor
	 * @param plugin reference to plugin main class
	 * @param player the player whose death triggered a death chest deployment
	 * @param chestSize the size of chest required to accommodate the players inventory
	 */
	public QuadrantSearch(final PluginMain plugin,
						  final Player player,
// Path: src/main/java/com/winterhavenmc/deathchest/PluginMain.java
// public final class PluginMain extends JavaPlugin {
// 
// 	public MessageBuilder<MessageId, Macro> messageBuilder;
// 	public WorldManager worldManager;
// 	public SoundConfiguration soundConfig;
// 	public ChestManager chestManager;
// 	public CommandManager commandManager;
// 	public ProtectionPluginRegistry protectionPluginRegistry;
// 
// 
// 	@Override
// 	public void onEnable() {
// 
// 		// bStats
// 		new Metrics(this, 13916);
// 
// 		// copy default config from jar if it doesn't exist
// 		saveDefaultConfig();
// 
// 		// initialize message builder
// 		messageBuilder = new MessageBuilder<>(this);
// 
// 		// instantiate sound configuration
// 		soundConfig = new YamlSoundConfiguration(this);
// 
// 		// instantiate world manager
// 		worldManager = new WorldManager(this);
// 
// 		// instantiate chest manager
// 		chestManager = new ChestManager(this);
// 
// 		// load all chests from datastore
// 		chestManager.loadChests();
// 
// 		// instantiate command manager
// 		commandManager = new CommandManager(this);
// 
// 		// initialize event listeners
// 		new PlayerEventListener(this);
// 		new BlockEventListener(this);
// 		new InventoryEventListener(this);
// 
// 		// instantiate protection plugin registry
// 		protectionPluginRegistry = new ProtectionPluginRegistry(this);
// 	}
// 
// 
// 	@Override
// 	public void onDisable() {
// 
// 		// close datastore
// 		chestManager.closeDataStore();
// 	}
// 
// }
// 
// Path: src/main/java/com/winterhavenmc/deathchest/chests/ChestSize.java
// public enum ChestSize {
// 
// 	SINGLE(27),
// 	DOUBLE(54);
// 
// 	private final int size;
// 
// 
// 	/**
// 	 * Constructor
// 	 *
// 	 * @param size the chest inventory size
// 	 */
// 	ChestSize(final int size) {
// 		this.size = size;
// 	}
// 
// 
// 	/**
// 	 * Determine chest size required for a given inventory size
// 	 *
// 	 * @param itemCount the number of ItemStacks to be considered for chest size
// 	 * @return ChestSize enum value, SINGLE or DOUBLE
// 	 */
// 	public static ChestSize selectFor(final int itemCount) {
// 
// 		if (itemCount > SINGLE.size) {
// 			return DOUBLE;
// 		}
// 		return SINGLE;
// 	}
// 
// }


// Path: src/main/java/com/winterhavenmc/deathchest/chests/search/QuadrantSearch.java
import com.winterhavenmc.deathchest.PluginMain;
import com.winterhavenmc.deathchest.chests.ChestSize;
import org.bukkit.Location;
import org.bukkit.entity.Player;

/*
 * Copyright (c) 2022 Tim Savage.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, version 3.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 */

package com.winterhavenmc.deathchest.chests.search;



/**
 * A class that implements a search strategy for a valid chest location
 */
public final class QuadrantSearch extends AbstractSearch {


	/**
	 * An enum that implements a cartesian quadrant system, where each member defines the sign of the x and z coordinates
	 */
	private enum Quadrant {
		I(1,1),
		II(-1,1),
		III(-1,-1),
		IV(1,-1);

		final int xFactor;
		final int zFactor;


		/**
		 * Constructor for the Quadrant enum
		 * @param xFactor the x multiplier to achieve negative or positive sign for the quadrant member
		 * @param zFactor the z multiplier to achieve negative or positive sign for the quadrant member
		 */
		Quadrant(final int xFactor, final int zFactor) {

			this.xFactor = xFactor;
			this.zFactor = zFactor;
		}
	}


	/**
	 * Class constructor
	 * @param plugin reference to plugin main class
	 * @param player the player whose death triggered a death chest deployment
	 * @param chestSize the size of chest required to accommodate the players inventory
	 */
	public QuadrantSearch(final PluginMain plugin,
						  final Player player,
						  final ChestSize chestSize) {