mirror of
https://github.com/songoda/UltimateStacker.git
synced 2025-03-12 14:39:12 +01:00
Fixed WildStacker conversion.
This commit is contained in:
parent
bff203bcf6
commit
904fdfd1dc
@ -4,7 +4,7 @@ stages:
|
||||
variables:
|
||||
name: "UltimateStacker"
|
||||
path: "/builds/$CI_PROJECT_PATH"
|
||||
version: "1.6.8"
|
||||
version: "1.6.9"
|
||||
|
||||
build:
|
||||
stage: build
|
||||
|
2
pom.xml
2
pom.xml
@ -96,7 +96,7 @@
|
||||
<dependency>
|
||||
<groupId>uk.antiperson</groupId>
|
||||
<artifactId>stackmob</artifactId>
|
||||
<version>4</version>
|
||||
<version>4-0-2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.minebuilders</groupId>
|
||||
|
@ -2,12 +2,15 @@ package com.songoda.ultimatestacker.convert;
|
||||
|
||||
import com.bgsoftware.wildstacker.WildStackerPlugin;
|
||||
import com.bgsoftware.wildstacker.api.WildStackerAPI;
|
||||
import com.bgsoftware.wildstacker.api.objects.StackedEntity;
|
||||
import com.bgsoftware.wildstacker.api.objects.StackedSpawner;
|
||||
import com.songoda.ultimatestacker.UltimateStacker;
|
||||
import com.songoda.ultimatestacker.entity.EntityStackManager;
|
||||
import com.songoda.ultimatestacker.spawner.SpawnerStack;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class WildStackerConvert implements Convert {
|
||||
|
||||
@ -35,12 +38,17 @@ public class WildStackerConvert implements Convert {
|
||||
@Override
|
||||
public void convertEntities() {
|
||||
EntityStackManager entityStackManager = plugin.getEntityStackManager();
|
||||
for (StackedEntity entity : WildStackerAPI.getWildStacker().getSystemManager().getStackedEntities()) {
|
||||
if (!entityStackManager.isStacked(entity.getLivingEntity())) {
|
||||
entityStackManager.addStack(entity.getLivingEntity(), entity.getStackAmount());
|
||||
continue;
|
||||
for (World world : Bukkit.getWorlds()) {
|
||||
for (Entity entity : world.getEntities()) {
|
||||
if (!(entity instanceof LivingEntity)) continue;
|
||||
if (!entityStackManager.isStacked(entity)) {
|
||||
entityStackManager
|
||||
.addStack(entity, WildStackerAPI.getEntityAmount((LivingEntity)entity));
|
||||
continue;
|
||||
}
|
||||
entityStackManager
|
||||
.getStack(entity).setAmount(WildStackerAPI.getEntityAmount((LivingEntity)entity));
|
||||
}
|
||||
entityStackManager.getStack(entity.getLivingEntity()).setAmount(entity.getStackAmount());
|
||||
}
|
||||
|
||||
}
|
||||
@ -49,7 +57,9 @@ public class WildStackerConvert implements Convert {
|
||||
public void convertSpawners() {
|
||||
for (StackedSpawner spawner : WildStackerAPI.getWildStacker().getSystemManager().getStackedSpawners()) {
|
||||
SpawnerStack stack = plugin.getSpawnerStackManager().getSpawner(spawner.getLocation());
|
||||
stack.setAmount(spawner.getStackAmount());
|
||||
|
||||
stack.setAmount(WildStackerAPI
|
||||
.getSpawnersAmount((CreatureSpawner) spawner.getLocation().getBlock().getState()));
|
||||
if (plugin.getHologram() != null)
|
||||
plugin.getHologram().add(stack);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user