Stacker plugin hook adjustment.

This commit is contained in:
Brianna 2021-05-27 09:47:20 -05:00
parent 3902dface4
commit 07eb0d5710
5 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,7 @@
package com.songoda.core.hooks; package com.songoda.core.hooks;
import com.songoda.core.hooks.stackers.Stacker; import com.songoda.core.hooks.stackers.Stacker;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
/** /**
@ -67,4 +68,8 @@ public class EntityStackerManager {
if (manager.isEnabled()) if (manager.isEnabled())
manager.getCurrentHook().add(entity, amount); manager.getCurrentHook().add(entity, amount);
} }
public static int getMinStackSize(EntityType type) {
return manager.isEnabled() ? manager.getCurrentHook().getMinStackSize(type) : 1;
}
} }

View File

@ -75,7 +75,7 @@ public class StackMob extends Stacker {
} }
@Override @Override
public int minimumEntityStack(EntityType type) { public int getMinStackSize(EntityType type) {
return 0; return 0;
} }

View File

@ -31,6 +31,6 @@ public abstract class Stacker implements Hook {
public abstract void add(LivingEntity entity, int amount); public abstract void add(LivingEntity entity, int amount);
public abstract int minimumEntityStack(EntityType type); public abstract int getMinStackSize(EntityType type);
} }

View File

@ -1,6 +1,7 @@
package com.songoda.core.hooks.stackers; package com.songoda.core.hooks.stackers;
import com.songoda.ultimatestacker.stackable.entity.EntityStack; import com.songoda.ultimatestacker.stackable.entity.EntityStack;
import com.songoda.ultimatestacker.stackable.entity.EntityStackManager;
import com.songoda.ultimatestacker.utils.Methods; import com.songoda.ultimatestacker.utils.Methods;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
@ -64,11 +65,11 @@ public class UltimateStacker extends Stacker {
@Override @Override
public void add(LivingEntity entity, int amount) { public void add(LivingEntity entity, int amount) {
plugin.getEntityStackManager().getStack(entity).createDuplicates(amount); plugin.getEntityStackManager().addStack(entity, amount);
} }
@Override @Override
public int minimumEntityStack(EntityType type) { public int getMinStackSize(EntityType type) {
return ((Plugin) plugin).getConfig().getInt("Entities.Min Stack Amount"); return ((Plugin) plugin).getConfig().getInt("Entities.Min Stack Amount");
} }
} }

View File

@ -68,7 +68,7 @@ public class WildStacker extends Stacker {
} }
@Override @Override
public int minimumEntityStack(EntityType type) { public int getMinStackSize(EntityType type) {
int min = plugin.getConfig().getInt("entities.minimum-limits." + type.name(), -1); int min = plugin.getConfig().getInt("entities.minimum-limits." + type.name(), -1);
if (min == -1) { if (min == -1) {
min = plugin.getConfig().getInt("entities.minimum-limits.all", -1); min = plugin.getConfig().getInt("entities.minimum-limits.all", -1);