// Path: src/protocolsupportpocketstuff/ProtocolSupportPocketStuff.java
// public class ProtocolSupportPocketStuff extends JavaPlugin implements Listener {
// 
// 	public static final String PREFIX = "[" + ChatColor.DARK_PURPLE + "PSPS" + ChatColor.RESET + "] ";
// 
// 	private static ProtocolSupportPocketStuff INSTANCE;
// 	public static ProtocolSupportPocketStuff getInstance() {
// 		return INSTANCE;
// 	}
// 
// 	@Override
// 	public void onLoad() {
// 		// = Pre-Init = \\
// 		INSTANCE = this;
// 		PlatformThings.bakeStuff();
// 		// = ResourcePacks = \\
// 		ResourcePackManager resourcePackManager = new ResourcePackManager();
// 		resourcePackManager.reloadPacks();
// 		PocketStuffAPI.setResourcePackManager(resourcePackManager);
// 	}
// 	
// 	@Override
// 	public void onEnable() {
// 		PluginManager pm = getServer().getPluginManager();
// 		pm.registerEvents(this, this);
// 		// = Config = \\
// 		saveDefaultConfig();
// 		// = Storage = \\
// 		Skins.getInstance().buildCache(
// 			getConfig().getInt("skins.cache-size"), 
// 			getConfig().getInt("skins.cache-rate")
// 		);
// 		// = API = \\
// 		PocketStuffAPI.registerPacketListeners(new PocketInfoReceiver());
// 		PocketStuffAPI.registerPacketListeners(new ModalReceiver());
// 		// = Metadata = \\
// 		PEMetaProviderSPI.setProvider(new EntityMetadataProvider());
// 		// = ResourcePacks = \\
// 		if (!PocketStuffAPI.getResourcePackManager().isEmpty()) {
// 			ResourcePackListener provider = new ResourcePackListener();
// 			pm.registerEvents(provider, this);
// 			PocketStuffAPI.registerPacketListeners(provider);
// 		}
// 		// = Skins = \\
// 		if (getConfig().getBoolean("skins.PCtoPE")) {
// 			PESkinsProviderSPI.setProvider(new PcToPeProvider());
// 		}
// 		if (getConfig().getBoolean("skins.PEtoPC")) {
// 			PeToPcProvider provider = new PeToPcProvider();
// 			pm.registerEvents(provider, this);
// 			PocketStuffAPI.registerPacketListeners(provider);
// 		}
// 		// = Commands = \\
// 		getCommand("protocolsupportpocketstuff").setExecutor(new CommandHandler());
// 		// = Welcome = \\
// 		pm("Hello world! :D");
// 	}
// 
// 	@EventHandler
// 	public void onConnectionOpen(ConnectionOpenEvent e) {
// 		ConnectionImpl con = (ConnectionImpl) e.getConnection();
// 		//We can't check if it is a PE player yet because it is too early to figure out
// 		//The packet listener will detach automatically if the connection turns out to be non-pe.
// 		con.addPacketListener(new PEReceiver.PEReceiverListener(con));
// 	}
// 
// 	@EventHandler
// 	public void onConnectionHandshake(ConnectionHandshakeEvent e) {
// 		Connection con = e.getConnection();
// 		if (PocketCon.isPocketConnection(con)) {
// 			// = Packet Listeners = \\
// 			//con.addPacketListener(new ModalResponsePacket().new decodeHandler(this, con));
// 			//if (getConfig().getBoolean("hacks.player-heads-skins.skull-blocks")) { con.addPacketListener(new SkullTilePacketListener(this, con)); }
// 			if (ServerPlatformIdentifier.get() == ServerPlatformIdentifier.SPIGOT) {
// 				/*if (getConfig().getBoolean("hacks.itemframes")) {
// 					con.addPacketListener(new ItemFramesPacketListener(this, con));
// 				}
// 				if (getConfig().getBoolean("hacks.bossbars")) {
// 					con.addPacketListener(new BossBarPacketListener(con));
// 				}*/
// 			}
// 		}
// 	}
// 
// 	@Override
// 	public void onDisable() {
// 		pm("Bye world :O");
// 	}
// 
// 	/**
// 	 * Sends a plugin message.
// 	 * @param msg
// 	 */
// 	public void pm(String msg) {
// 		msg = PREFIX + msg;
// 		if (getConfig().getBoolean("logging.disable-colors", false)) {
// 			msg = ChatColor.stripColor(msg);
// 		}
// 		getServer().getConsoleSender().sendMessage(msg);
// 	}
// 
// 	/**
// 	 * Sends a debug plugin message.
// 	 * @param msg
// 	 */
// 	public void debug(String msg) {
// 		if (!getConfig().getBoolean("logging.enable-debug", false)) { return; }
// 		msg = PREFIX + " [DEBUG] " + msg;
// 		if (getConfig().getBoolean("logging.disable-colors", false)) {
// 			msg = ChatColor.stripColor(msg);
// 		}
// 		getServer().getConsoleSender().sendMessage(msg);
// 	}
// 
// }


import org.apache.commons.io.IOUtils;
import protocolsupport.protocol.utils.types.Position;
import protocolsupportpocketstuff.ProtocolSupportPocketStuff;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
package protocolsupportpocketstuff.util;



public class StuffUtils {
	public static final int CHUNK_SIZE = 1048576;
	public static final String SKIN_PROPERTY_NAME = "textures";
	public static final String APPLY_SKIN_ON_JOIN_KEY = "applySkinOnJoin";
	public static final String CLIENT_INFO_KEY = "PEClientInformationMap";
	public static final String CLIENT_UUID_KEY = "clientUniqueId";
	private static final String RESOURCES_DIRECTORY = "resources";

	public static BufferedReader getResource(String name) {
		return new BufferedReader(new InputStreamReader(getResourceAsStream(name), StandardCharsets.UTF_8));
	}

	public static String getResourceAsString(String name) {
		try {
			return IOUtils.toString(getResource(name));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static InputStream getResourceAsStream(String name) {
// Path: src/protocolsupportpocketstuff/ProtocolSupportPocketStuff.java
// public class ProtocolSupportPocketStuff extends JavaPlugin implements Listener {
// 
// 	public static final String PREFIX = "[" + ChatColor.DARK_PURPLE + "PSPS" + ChatColor.RESET + "] ";
// 
// 	private static ProtocolSupportPocketStuff INSTANCE;
// 	public static ProtocolSupportPocketStuff getInstance() {
// 		return INSTANCE;
// 	}
// 
// 	@Override
// 	public void onLoad() {
// 		// = Pre-Init = \\
// 		INSTANCE = this;
// 		PlatformThings.bakeStuff();
// 		// = ResourcePacks = \\
// 		ResourcePackManager resourcePackManager = new ResourcePackManager();
// 		resourcePackManager.reloadPacks();
// 		PocketStuffAPI.setResourcePackManager(resourcePackManager);
// 	}
// 	
// 	@Override
// 	public void onEnable() {
// 		PluginManager pm = getServer().getPluginManager();
// 		pm.registerEvents(this, this);
// 		// = Config = \\
// 		saveDefaultConfig();
// 		// = Storage = \\
// 		Skins.getInstance().buildCache(
// 			getConfig().getInt("skins.cache-size"), 
// 			getConfig().getInt("skins.cache-rate")
// 		);
// 		// = API = \\
// 		PocketStuffAPI.registerPacketListeners(new PocketInfoReceiver());
// 		PocketStuffAPI.registerPacketListeners(new ModalReceiver());
// 		// = Metadata = \\
// 		PEMetaProviderSPI.setProvider(new EntityMetadataProvider());
// 		// = ResourcePacks = \\
// 		if (!PocketStuffAPI.getResourcePackManager().isEmpty()) {
// 			ResourcePackListener provider = new ResourcePackListener();
// 			pm.registerEvents(provider, this);
// 			PocketStuffAPI.registerPacketListeners(provider);
// 		}
// 		// = Skins = \\
// 		if (getConfig().getBoolean("skins.PCtoPE")) {
// 			PESkinsProviderSPI.setProvider(new PcToPeProvider());
// 		}
// 		if (getConfig().getBoolean("skins.PEtoPC")) {
// 			PeToPcProvider provider = new PeToPcProvider();
// 			pm.registerEvents(provider, this);
// 			PocketStuffAPI.registerPacketListeners(provider);
// 		}
// 		// = Commands = \\
// 		getCommand("protocolsupportpocketstuff").setExecutor(new CommandHandler());
// 		// = Welcome = \\
// 		pm("Hello world! :D");
// 	}
// 
// 	@EventHandler
// 	public void onConnectionOpen(ConnectionOpenEvent e) {
// 		ConnectionImpl con = (ConnectionImpl) e.getConnection();
// 		//We can't check if it is a PE player yet because it is too early to figure out
// 		//The packet listener will detach automatically if the connection turns out to be non-pe.
// 		con.addPacketListener(new PEReceiver.PEReceiverListener(con));
// 	}
// 
// 	@EventHandler
// 	public void onConnectionHandshake(ConnectionHandshakeEvent e) {
// 		Connection con = e.getConnection();
// 		if (PocketCon.isPocketConnection(con)) {
// 			// = Packet Listeners = \\
// 			//con.addPacketListener(new ModalResponsePacket().new decodeHandler(this, con));
// 			//if (getConfig().getBoolean("hacks.player-heads-skins.skull-blocks")) { con.addPacketListener(new SkullTilePacketListener(this, con)); }
// 			if (ServerPlatformIdentifier.get() == ServerPlatformIdentifier.SPIGOT) {
// 				/*if (getConfig().getBoolean("hacks.itemframes")) {
// 					con.addPacketListener(new ItemFramesPacketListener(this, con));
// 				}
// 				if (getConfig().getBoolean("hacks.bossbars")) {
// 					con.addPacketListener(new BossBarPacketListener(con));
// 				}*/
// 			}
// 		}
// 	}
// 
// 	@Override
// 	public void onDisable() {
// 		pm("Bye world :O");
// 	}
// 
// 	/**
// 	 * Sends a plugin message.
// 	 * @param msg
// 	 */
// 	public void pm(String msg) {
// 		msg = PREFIX + msg;
// 		if (getConfig().getBoolean("logging.disable-colors", false)) {
// 			msg = ChatColor.stripColor(msg);
// 		}
// 		getServer().getConsoleSender().sendMessage(msg);
// 	}
// 
// 	/**
// 	 * Sends a debug plugin message.
// 	 * @param msg
// 	 */
// 	public void debug(String msg) {
// 		if (!getConfig().getBoolean("logging.enable-debug", false)) { return; }
// 		msg = PREFIX + " [DEBUG] " + msg;
// 		if (getConfig().getBoolean("logging.disable-colors", false)) {
// 			msg = ChatColor.stripColor(msg);
// 		}
// 		getServer().getConsoleSender().sendMessage(msg);
// 	}
// 
// }


// Path: src/protocolsupportpocketstuff/util/StuffUtils.java
import org.apache.commons.io.IOUtils;
import protocolsupport.protocol.utils.types.Position;
import protocolsupportpocketstuff.ProtocolSupportPocketStuff;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

package protocolsupportpocketstuff.util;



public class StuffUtils {
	public static final int CHUNK_SIZE = 1048576;
	public static final String SKIN_PROPERTY_NAME = "textures";
	public static final String APPLY_SKIN_ON_JOIN_KEY = "applySkinOnJoin";
	public static final String CLIENT_INFO_KEY = "PEClientInformationMap";
	public static final String CLIENT_UUID_KEY = "clientUniqueId";
	private static final String RESOURCES_DIRECTORY = "resources";

	public static BufferedReader getResource(String name) {
		return new BufferedReader(new InputStreamReader(getResourceAsStream(name), StandardCharsets.UTF_8));
	}

	public static String getResourceAsString(String name) {
		try {
			return IOUtils.toString(getResource(name));
		} catch (IOException e) {
			e.printStackTrace();
		}
		return null;
	}

	public static InputStream getResourceAsStream(String name) {
		return ProtocolSupportPocketStuff.class.getClassLoader().getResourceAsStream(RESOURCES_DIRECTORY + "/" + name);