mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-01-25 00:31:21 +01:00
Spawners fix
This commit is contained in:
parent
116442a51e
commit
ede59bf3bc
@ -81,7 +81,7 @@ public class UltimateStacker extends JavaPlugin {
|
||||
settingsManager.updateSettings();
|
||||
|
||||
for (EntityType value : EntityType.values()) {
|
||||
if (value.isSpawnable() && value.isAlive() && !value.toString().toLowerCase().contains("armor")) {
|
||||
if (value.isSpawnable() && value.isAlive() && !value.toString().contains("ARMOR")) {
|
||||
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Enabled", true);
|
||||
mobFile.getConfig().addDefault("Mobs." + value.name() + ".Max Stack Size", -1);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public class UltimateStacker extends JavaPlugin {
|
||||
itemFile.saveConfig();
|
||||
|
||||
for (EntityType value : EntityType.values()) {
|
||||
if (value.isSpawnable() && value.isAlive() && !value.toString().toLowerCase().contains("armor")) {
|
||||
if (value.isSpawnable() && value.isAlive() && !value.toString().contains("ARMOR")) {
|
||||
spawnerFile.getConfig().addDefault("Spawners." + value.name() + ".Max Stack Size", -1);
|
||||
spawnerFile.getConfig().addDefault("Spawners." + value.name() + ".Display Name", TextComponent.formatText(value.name().toLowerCase().replace("_", " "), true));
|
||||
}
|
||||
@ -320,6 +320,10 @@ public class UltimateStacker extends JavaPlugin {
|
||||
return itemFile;
|
||||
}
|
||||
|
||||
public ConfigWrapper getSpawnerFile() {
|
||||
return spawnerFile;
|
||||
}
|
||||
|
||||
public static UltimateStacker getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class BlockListeners implements Listener {
|
||||
EntityType itemType = cs.getSpawnedType();
|
||||
|
||||
int itemAmount = getSpawnerAmount(item);
|
||||
int specific = instance.getItemFile().getConfig().getInt("Spawners." + itemType.name() + ".Max Stack Size");
|
||||
int specific = instance.getSpawnerFile().getConfig().getInt("Spawners." + cs.getSpawnedType().name() + ".Max Stack Size");
|
||||
int maxStackSize = specific == -1 ? instance.getConfig().getInt("Spawners.Max Stack Size") : specific;
|
||||
|
||||
cs = (CreatureSpawner)block.getState();
|
||||
@ -72,10 +72,10 @@ public class BlockListeners implements Listener {
|
||||
|
||||
stack.setAmount(stack.getAmount() + itemAmount);
|
||||
instance.getHologramHandler().updateHologram(stack);
|
||||
Methods.takeItem(player, itemAmount);
|
||||
}
|
||||
}
|
||||
|
||||
Methods.takeItem(player, itemAmount);
|
||||
|
||||
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(instance, () -> instance.getHologramHandler().processChange(block), 10L);
|
||||
|
||||
@ -135,10 +135,11 @@ public class BlockListeners implements Listener {
|
||||
}
|
||||
|
||||
|
||||
public int getSpawnerAmount(ItemStack item) {
|
||||
private int getSpawnerAmount(ItemStack item) {
|
||||
if (!item.hasItemMeta() || !item.getItemMeta().hasDisplayName()) return 1;
|
||||
if (item.getItemMeta().getDisplayName().contains(":")) {
|
||||
return NumberUtils.toInt(item.getItemMeta().getDisplayName().replace("\u00A7", "").split(":")[0], 0);
|
||||
int amt = NumberUtils.toInt(item.getItemMeta().getDisplayName().replace("\u00A7", "").split(":")[0], 1);
|
||||
return amt == 0 ? 1 : amt;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user