Compare commits

..

No commits in common. "e3cfe4ef82f98bbd2b02c5e04031fb5830f5b533" and "36ff6aa10f8b2f3329890957ca8e6f2ef57b9459" have entirely different histories.

4 changed files with 12 additions and 13 deletions

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>UltimateStacker-Parent</artifactId>
<version>3.1.7</version>
<version>3.1.6</version>
</parent>
<artifactId>UltimateStacker-API</artifactId>
<version>1.0.0-SNAPSHOT</version>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>com.craftaro</groupId>
<artifactId>UltimateStacker-Parent</artifactId>
<version>3.1.7</version>
<version>3.1.6</version>
</parent>
<artifactId>UltimateStacker-Plugin</artifactId>

View File

@ -12,6 +12,7 @@ import com.craftaro.ultimatestacker.utils.Async;
import com.craftaro.ultimatestacker.utils.Methods;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.ExperienceOrb;
import org.bukkit.entity.LivingEntity;
@ -30,7 +31,7 @@ import java.util.UUID;
public class EntityStackImpl implements EntityStack {
private final UltimateStacker plugin = UltimateStacker.getInstance();
private Object STACKED_ENTITY_KEY;
private final NamespacedKey STACKED_ENTITY_KEY = new NamespacedKey(plugin, "US_AMOUNT");
private int amount;
private LivingEntity hostEntity;
@ -40,14 +41,12 @@ public class EntityStackImpl implements EntityStack {
* @param entity The entity to get the stack from.
*/
public EntityStackImpl(LivingEntity entity) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14))
this.STACKED_ENTITY_KEY = new org.bukkit.NamespacedKey(plugin, "US_AMOUNT");
if (entity == null) return;
if (!UltimateStacker.getInstance().getEntityStackManager().isStackedEntity(entity)) {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
PersistentDataContainer container = entity.getPersistentDataContainer();
if (container.has((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER)) {
this.amount = container.get((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER);
if (container.has(STACKED_ENTITY_KEY, PersistentDataType.INTEGER)) {
this.amount = container.get(STACKED_ENTITY_KEY, PersistentDataType.INTEGER);
entity.setMetadata("US_AMOUNT", new FixedMetadataValue(UltimateStacker.getInstance(), amount));
} else {
entity.setMetadata("US_AMOUNT", new FixedMetadataValue(UltimateStacker.getInstance(), 1));
@ -60,8 +59,8 @@ public class EntityStackImpl implements EntityStack {
} else {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
PersistentDataContainer container = entity.getPersistentDataContainer();
if (container.has((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER)) {
this.amount = container.get((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER);
if (container.has(STACKED_ENTITY_KEY, PersistentDataType.INTEGER)) {
this.amount = container.get(STACKED_ENTITY_KEY, PersistentDataType.INTEGER);
} else {
this.amount = getMetaCount(entity);
}
@ -95,7 +94,7 @@ public class EntityStackImpl implements EntityStack {
this.amount = amount;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
PersistentDataContainer container = entity.getPersistentDataContainer();
container.set((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER, amount);
container.set(STACKED_ENTITY_KEY, PersistentDataType.INTEGER, amount);
} else {
entity.setMetadata("US_AMOUNT", new FixedMetadataValue(UltimateStacker.getInstance(), amount));
}
@ -117,7 +116,7 @@ public class EntityStackImpl implements EntityStack {
this.amount = amount;
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
PersistentDataContainer container = hostEntity.getPersistentDataContainer();
container.set((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY, PersistentDataType.INTEGER, amount);
container.set(STACKED_ENTITY_KEY, PersistentDataType.INTEGER, amount);
} else {
hostEntity.setMetadata("US_AMOUNT", new FixedMetadataValue(UltimateStacker.getInstance(), amount));
}
@ -268,7 +267,7 @@ public class EntityStackImpl implements EntityStack {
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) {
PersistentDataContainer container = hostEntity.getPersistentDataContainer();
container.remove((org.bukkit.NamespacedKey) STACKED_ENTITY_KEY);
container.remove(STACKED_ENTITY_KEY);
} else {
hostEntity.removeMetadata("US_AMOUNT", plugin);
}

View File

@ -7,7 +7,7 @@
<groupId>com.craftaro</groupId>
<artifactId>UltimateStacker-Parent</artifactId>
<packaging>pom</packaging>
<version>3.1.7</version>
<version>3.1.6</version>
<modules>
<module>UltimateStacker-API</module>