Updates UltimateStacker-API dependency to use the new name+version

This commit is contained in:
Christian Koop 2023-06-30 22:50:28 +02:00
parent 8c80d86cc5
commit 1b2b2a41a3
No known key found for this signature in database
GPG Key ID: 89A8181384E010A3
3 changed files with 27 additions and 21 deletions

View File

@ -302,8 +302,8 @@
<dependency>
<groupId>com.craftaro</groupId>
<artifactId>UltimateStackerAPI</artifactId>
<version>1.0.0</version>
<artifactId>UltimateStacker-API</artifactId>
<version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

View File

@ -1,6 +1,6 @@
package com.craftaro.core.hooks.stackers;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
import com.craftaro.ultimatestacker.api.stack.entity.EntityStack;
import org.bukkit.Bukkit;
import org.bukkit.entity.EntityType;
@ -22,7 +22,7 @@ public class UltimateStacker extends Stacker {
@Override
public boolean isEnabled() {
return plugin.isEnabled();
return this.plugin.isEnabled();
}
@Override
@ -37,38 +37,38 @@ public class UltimateStacker extends Stacker {
@Override
public void setItemAmount(Item item, int amount) {
UltimateStackerAPI.getStackedItemManager().getStackedItem(item, true).setAmount(amount);
UltimateStackerApi.getStackedItemManager().getStackedItem(item, true).setAmount(amount);
}
@Override
public int getItemAmount(Item item) {
return UltimateStackerAPI.getStackedItemManager().getActualItemAmount(item);
return UltimateStackerApi.getStackedItemManager().getActualItemAmount(item);
}
@Override
public boolean isStacked(LivingEntity entity) {
return UltimateStackerAPI.getEntityStackManager().isStackedEntity(entity);
return UltimateStackerApi.getEntityStackManager().isStackedEntity(entity);
}
@Override
public int getSize(LivingEntity entity) {
return isStacked(entity) ? UltimateStackerAPI.getEntityStackManager().getStackedEntity(entity).getAmount() : 0;
return isStacked(entity) ? UltimateStackerApi.getEntityStackManager().getStackedEntity(entity).getAmount() : 0;
}
@Override
public void remove(LivingEntity entity, int amount) {
EntityStack stack = UltimateStackerAPI.getEntityStackManager().getStackedEntity(entity);
EntityStack stack = UltimateStackerApi.getEntityStackManager().getStackedEntity(entity);
stack.take(amount);
}
@Override
public void add(LivingEntity entity, int amount) {
EntityStack stack = UltimateStackerAPI.getEntityStackManager().getStackedEntity(entity);
EntityStack stack = UltimateStackerApi.getEntityStackManager().getStackedEntity(entity);
stack.add(amount);
}
@Override
public int getMinStackSize(EntityType type) {
return ((Plugin) plugin).getConfig().getInt("Entities.Min Stack Amount", 1);
return this.plugin.getConfig().getInt("Entities.Min Stack Amount", 1);
}
}

View File

@ -1,7 +1,7 @@
package com.craftaro.core.lootables.loot;
import com.craftaro.core.SongodaCore;
import com.craftaro.ultimatestacker.api.UltimateStackerAPI;
import com.craftaro.ultimatestacker.api.UltimateStackerApi;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
@ -68,7 +68,7 @@ public class DropUtils {
private static void dropItems(List<ItemStack> items, EntityDeathEvent event) {
if (SongodaCore.isRegistered("UltimateStacker")) {
List<StackedItem> stacks = new ArrayList<>();
int maxSize = UltimateStackerAPI.getSettings().getMaxItemStackSize() - 64;
int maxSize = UltimateStackerApi.getSettings().getMaxItemStackSize() - 64;
for (ItemStack item : items) {
StackedItem stack = stacks.stream().filter(stackedItem -> stackedItem.getItem().getType() == item.getType()).findFirst().orElse(null);
if (stack == null) {
@ -80,11 +80,11 @@ public class DropUtils {
newAmount -= maxSize;
stacks.add(new StackedItem(item, maxSize));
}
stack.setamount(newAmount);
stack.setAmount(newAmount);
}
Bukkit.getScheduler().runTask(UltimateStackerAPI.getPlugin(), () -> {
Bukkit.getScheduler().runTask(UltimateStackerApi.getPlugin(), () -> {
for (StackedItem stack : stacks) {
UltimateStackerAPI.getStackedItemManager().createStack(stack.getItem(), event.getEntity().getLocation(), stack.getAmount());
UltimateStackerApi.getStackedItemManager().createStack(stack.getItem(), event.getEntity().getLocation(), stack.getAmount());
}
});
return;
@ -107,11 +107,9 @@ public class DropUtils {
}
}
});
}
private static class StackedItem {
private final ItemStack item;
private int amount;
@ -121,19 +119,27 @@ public class DropUtils {
}
public Material getMaterial() {
return item.getType();
return this.item.getType();
}
public ItemStack getItem() {
return item;
return this.item;
}
public int getAmount() {
return amount;
return this.amount;
}
/**
* @deprecated Use {@link #setAmount(int)} instead.
*/
@Deprecated
public void setamount(int amount) {
this.amount = amount;
}
public void setAmount(int amount) {
this.amount = amount;
}
}
}