1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Special exception for armor stands in wildstacker

This commit is contained in:
Zrips 2024-01-25 13:53:45 +02:00
parent 757d621e0d
commit 30ca00073f
2 changed files with 7 additions and 9 deletions

View File

@ -6,19 +6,17 @@ import org.bukkit.entity.Player;
import com.bgsoftware.wildstacker.api.WildStackerAPI; import com.bgsoftware.wildstacker.api.WildStackerAPI;
import com.bgsoftware.wildstacker.api.objects.StackedEntity; import com.bgsoftware.wildstacker.api.objects.StackedEntity;
import net.Zrips.CMILib.Version.Version;
public class WildStackerHandler { public class WildStackerHandler {
public int getEntityAmount(LivingEntity entity) { public int getEntityAmount(LivingEntity entity) {
if (entity instanceof Player) if (entity instanceof Player || Version.isCurrentEqualOrHigher(Version.v1_8_R1) && entity instanceof org.bukkit.entity.ArmorStand)
return 0; return 0;
StackedEntity stacked = WildStackerAPI.getStackedEntity(entity); StackedEntity stacked = WildStackerAPI.getStackedEntity(entity);
if(stacked == null) { return stacked == null ? 0 : stacked.getStackAmount();
return 0;
}
return stacked.getStackAmount();
} }
} }

View File

@ -171,10 +171,10 @@ public class JobsListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(final PlayerJoinEvent event) { public void onPlayerJoin(final PlayerJoinEvent event) {
if (!Jobs.getGCManager().MultiServerCompatability()) if (Jobs.getGCManager().MultiServerCompatability()) {
CMIScheduler.runTaskLater(() -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L);
} else {
Jobs.getPlayerManager().playerJoin(event.getPlayer()); Jobs.getPlayerManager().playerJoin(event.getPlayer());
else {
CMIScheduler.get().runTaskLater(() -> Jobs.getPlayerManager().playerJoin(event.getPlayer()), 40L);
} }
} }