mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-30 14:03:23 +01:00
add stacker methods to get min entity stack
This commit is contained in:
parent
aeafb31b04
commit
fa7d5a5974
@ -1,6 +1,7 @@
|
||||
package com.songoda.core.hooks.stackers;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import uk.antiperson.stackmob.api.EntityManager;
|
||||
@ -72,4 +73,10 @@ public class StackMob extends Stacker {
|
||||
StackedEntity stackedEntity = plugin.getStackedEntity(entity);
|
||||
stackedEntity.setSize(stackedEntity.getSize() + amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minimumEntityStack(EntityType type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.songoda.core.hooks.stackers;
|
||||
|
||||
import com.songoda.core.hooks.Hook;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
@ -29,4 +30,7 @@ public abstract class Stacker implements Hook {
|
||||
}
|
||||
|
||||
public abstract void add(LivingEntity entity, int amount);
|
||||
|
||||
public abstract int minimumEntityStack(EntityType type);
|
||||
|
||||
}
|
||||
|
@ -3,8 +3,10 @@ package com.songoda.core.hooks.stackers;
|
||||
import com.songoda.ultimatestacker.entity.EntityStack;
|
||||
import com.songoda.ultimatestacker.utils.Methods;
|
||||
import java.lang.reflect.Method;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class UltimateStacker extends Stacker {
|
||||
|
||||
@ -80,4 +82,9 @@ public class UltimateStacker extends Stacker {
|
||||
public void add(LivingEntity entity, int amount) {
|
||||
plugin.getEntityStackManager().getStack(entity).addAmount(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minimumEntityStack(EntityType type) {
|
||||
return ((Plugin) plugin).getConfig().getInt("Entities.Min Stack Amount");
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,19 @@ package com.songoda.core.hooks.stackers;
|
||||
|
||||
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
||||
import com.bgsoftware.wildstacker.api.objects.StackedEntity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
|
||||
public class WildStacker extends Stacker {
|
||||
|
||||
final Plugin plugin;
|
||||
|
||||
public WildStacker(Plugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "WildStacker";
|
||||
@ -58,4 +66,14 @@ public class WildStacker extends Stacker {
|
||||
StackedEntity stackedEntity = WildStackerAPI.getStackedEntity(entity);
|
||||
stackedEntity.setStackAmount(stackedEntity.getStackAmount() + amount, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int minimumEntityStack(EntityType type) {
|
||||
int min = plugin.getConfig().getInt("entities.minimum-limits." + type.name(), -1);
|
||||
if (min == -1) {
|
||||
min = plugin.getConfig().getInt("entities.minimum-limits.all", -1);
|
||||
}
|
||||
return min == -1 ? 0 : min;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user