Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,30 @@ public void stopHopperTask(Location hopperLoc) {
}
}

/**
* Restart hopper task for a spawner location.
* This is called when spawner stack size changes to ensure hopper continues working.
* @param spawnerLoc The location of the spawner
*/
public void restartHopperForSpawner(Location spawnerLoc) {
if (!plugin.getConfig().getBoolean("hopper.enabled", false)) return;

// Find hopper below the spawner
Block spawnerBlock = spawnerLoc.getBlock();
if (spawnerBlock.getType() != Material.SPAWNER) return;

Block hopperBlock = spawnerBlock.getRelative(BlockFace.DOWN);
if (hopperBlock.getType() != Material.HOPPER) return;

Location hopperLoc = hopperBlock.getLocation();

// Stop existing hopper task if any
stopHopperTask(hopperLoc);

// Start new hopper task
startHopperTask(hopperLoc, spawnerLoc);
}

private void transferItems(Location hopperLoc, Location spawnerLoc) {
SpawnerData spawner = spawnerManager.getSpawnerByLocation(spawnerLoc);
if (spawner == null) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import github.nighter.smartspawner.spawner.gui.synchronization.SpawnerGuiViewManager;
import github.nighter.smartspawner.spawner.properties.SpawnerData;
import github.nighter.smartspawner.spawner.sell.SpawnerSellManager;
import github.nighter.smartspawner.utils.DynamicMaterialDetector;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Particle;
Expand All @@ -32,8 +31,18 @@
import java.util.concurrent.ConcurrentHashMap;

public class SpawnerMenuAction implements Listener {
private static final Set<Material> SPAWNER_INFO_MATERIALS =
DynamicMaterialDetector.getSpawnerInfoMaterials();
// Spawner info materials - manually defined to avoid Material.values() iteration
// which can trigger CraftLegacy initialization
private static final Set<Material> SPAWNER_INFO_MATERIALS = Set.of(
Material.PLAYER_HEAD,
Material.SPAWNER,
Material.ZOMBIE_HEAD,
Material.SKELETON_SKULL,
Material.WITHER_SKELETON_SKULL,
Material.CREEPER_HEAD,
Material.PIGLIN_HEAD,
Material.DRAGON_HEAD
);
private final SmartSpawner plugin;
private final SpawnerMenuUI spawnerMenuUI;
private final SpawnerStackerUI spawnerStackerUI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public void loadConfigurations() {
continue;
}

// Validate entity type exists in current version
EntityType entityType;
try {
entityType = EntityType.valueOf(entityName.toUpperCase());
} catch (IllegalArgumentException e) {
plugin.getLogger().warning("Entity type '" + entityName + "' is not available in server version " +
plugin.getServer().getBukkitVersion() + " - skipping");
continue;
}

ConfigurationSection entitySection = lootConfig.getConfigurationSection(entityName);
if (entitySection == null) continue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ private void updateStackSize(int newStackSize) {
if (plugin.getSpawnerMenuFormUI() != null) {
plugin.getSpawnerMenuFormUI().invalidateSpawnerCache(this.spawnerId);
}

// Restart hopper task if hopper integration is enabled
// This ensures hopper continues to work after stack size changes
if (plugin.getHopperHandler() != null) {
plugin.getHopperHandler().restartHopperForSpawner(this.spawnerLocation);
}
}

private void recreateVirtualInventory() {
Expand Down

This file was deleted.