mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-31 03:31:21 +01:00
Merge branch 'development'
This commit is contained in:
commit
465473e9a4
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.10.17"
|
||||
version: "1.10.18"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
@ -7,19 +7,12 @@ import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.settings.Settings;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -29,6 +22,10 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class EntityListeners implements Listener {
|
||||
|
||||
private final UltimateStacker plugin;
|
||||
@ -70,7 +67,10 @@ public class EntityListeners implements Listener {
|
||||
EntityStack stack = stackManager.getStack(entity);
|
||||
|
||||
ItemStack item = event.getEntity().getItemStack();
|
||||
int amount = (stack.getAmount() - 1) + item.getAmount();
|
||||
item.setAmount(Math.min((stack.getAmount() - 1) + item.getAmount(), item.getMaxStackSize()));
|
||||
if (amount > item.getMaxStackSize())
|
||||
UltimateStacker.updateItemAmount(event.getEntity(), amount);
|
||||
event.getEntity().setItemStack(item);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,9 @@ public class SpawnerListeners implements Listener {
|
||||
|
||||
EntityType entityType;
|
||||
if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_13))
|
||||
entityType = EntityType.valueOf(itemType.name().replace("_SPAWN_EGG", "").replace("MOOSHROOM", "MUSHROOM_COW"));
|
||||
entityType = EntityType.valueOf(itemType.name().replace("_SPAWN_EGG", "")
|
||||
.replace("MOOSHROOM", "MUSHROOM_COW")
|
||||
.replace("ZOMBIE_PIGMAN", "PIG_ZOMBIE"));
|
||||
else if (ServerVersion.isServerVersionAtLeast(ServerVersion.V1_12)) {
|
||||
String str = Reflection.getNBTTagCompound(Reflection.getNMSItemStack(event.getItem())).toString();
|
||||
if (str.contains("minecraft:"))
|
||||
|
Loading…
Reference in New Issue
Block a user