package protocolsupportpocketstuff.api.util;

import org.bukkit.entity.Entity;
import protocolsupport.api.Connection;
import protocolsupport.protocol.utils.datawatcher.DataWatcherObject;
import protocolsupport.protocol.utils.datawatcher.objects.DataWatcherObjectFloatLe;
import protocolsupport.utils.CollectionsUtils;
import protocolsupportpocketstuff.packet.play.EntityDataPacket;

import java.util.concurrent.ConcurrentHashMap;

public class PocketUtils {
	private static final ConcurrentHashMap<Integer, Float> entityScales = new ConcurrentHashMap<>();

	public static void setScale(Entity entity, float scale) {
		setScale(entity.getEntityId(), scale);
	}

	public static void setScale(int entityId, float scale) {
		if (scale == 1) {
			entityScales.remove(entityId);
		} else {
			entityScales.put(entityId, scale);
		}
		// Update to all players
		CollectionsUtils.ArrayMap<DataWatcherObject<?>> metadata = new CollectionsUtils.ArrayMap<>(76);
		metadata.put(39, new DataWatcherObjectFloatLe(scale));
		EntityDataPacket packet = new EntityDataPacket(entityId, metadata);
		for (Connection connection : PocketCon.getPocketConnections()) {
			PocketCon.sendPocketPacket(connection, packet);
		}
	}

	public static boolean hasCustomScale(int entityId) {
		return entityScales.containsKey(entityId);
	}

	public static float getCustomScale(int entityId) {
		return entityScales.get(entityId);
	}
}
@@ -550,16 +550,94 @@
 p%3C%3E();%0A%0A
+%09/***%0A%09 * Sets the scale of an entity%0A%09 * @param entity%0A%09 * @param scale%0A%09 */%0A
 %09public 
@@ -728,24 +728,107 @@
 scale);%0A%09%7D%0A%0A
+%09/***%0A%09 * Sets the scale of an entity ID%0A%09 * @param entityId%0A%09 * @param scale%0A%09 */%0A
 %09public stat
@@ -1363,109 +1363,347 @@
 %7D%0A%0A%09
-public static boolean hasCustomScale(int entityId) %7B%0A%09%09return entityScales.containsKey(entityId);%0A%09%7D%0A
+/***%0A%09 * Returns if an entityId has an custom scale set%0A%09 * @param entityId%0A%09 * @return if the entityId has an custom scale set%0A%09 */%0A%09public static boolean hasCustomScale(int entityId) %7B%0A%09%09return entityScales.containsKey(entityId);%0A%09%7D%0A%0A%09/***%0A%09 * Gets the entityId custom scale%0A%09 * @param entityId%0A%09 * @return the entityId custom scale%0A%09 */
 %0A%09pu

Add javadocs to the entity scale API