mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-02 14:29:07 +01:00
Fix WildStacker integration
This commit is contained in:
parent
93f5423300
commit
350c5b74da
@ -1,7 +1,5 @@
|
|||||||
package com.gamingmesh.jobs.hooks.wildStacker;
|
package com.gamingmesh.jobs.hooks.wildStacker;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -10,13 +8,17 @@ import com.bgsoftware.wildstacker.api.objects.StackedEntity;
|
|||||||
|
|
||||||
public class WildStackerHandler {
|
public class WildStackerHandler {
|
||||||
|
|
||||||
public boolean isStackedEntity(LivingEntity entity) {
|
public int getEntityAmount(LivingEntity entity) {
|
||||||
if (entity instanceof Player)
|
|
||||||
return false;
|
|
||||||
return WildStackerAPI.getStackedEntity(entity) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<StackedEntity> getStackedEntities() {
|
if (entity instanceof Player)
|
||||||
return WildStackerAPI.getWildStacker().getSystemManager().getStackedEntities();
|
return 0;
|
||||||
|
|
||||||
|
StackedEntity stacked = WildStackerAPI.getStackedEntity(entity);
|
||||||
|
|
||||||
|
if(stacked == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return stacked.getStackAmount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.bgsoftware.wildstacker.api.enums.StackSplit;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -125,7 +126,6 @@ import net.Zrips.CMILib.Container.CMILocation;
|
|||||||
import net.Zrips.CMILib.Entities.CMIEntityType;
|
import net.Zrips.CMILib.Entities.CMIEntityType;
|
||||||
import net.Zrips.CMILib.Items.CMIItemStack;
|
import net.Zrips.CMILib.Items.CMIItemStack;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
|
|
||||||
public final class JobsPaymentListener implements Listener {
|
public final class JobsPaymentListener implements Listener {
|
||||||
@ -336,12 +336,10 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().payForStackedEntities) {
|
if (Jobs.getGCManager().payForStackedEntities) {
|
||||||
if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(sheep)) {
|
if (JobsHook.WildStacker.isEnabled() && !StackSplit.SHEEP_SHEAR.isEnabled()) {
|
||||||
for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
|
for(int i = 0; i < HookManager.getWildStackerHandler().getEntityAmount(sheep) - 1; i++) {
|
||||||
if (stacked.getType() == sheep.getType()) {
|
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||||
Jobs.action(jDamager, new CustomKillInfo(((Sheep) stacked.getLivingEntity()).getColor().name(), ActionType.SHEAR));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(sheep)) {
|
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(sheep)) {
|
||||||
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
||||||
if (stacked.getEntity().getType() == sheep.getType()) {
|
if (stacked.getEntity().getType() == sheep.getType()) {
|
||||||
@ -588,11 +586,9 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().payForStackedEntities) {
|
if (Jobs.getGCManager().payForStackedEntities) {
|
||||||
if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(animal)) {
|
if (JobsHook.WildStacker.isEnabled()) {
|
||||||
for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
|
for (int i = 0; i < HookManager.getWildStackerHandler().getEntityAmount(animal) - 1; i++) {
|
||||||
if (stacked.getType() == animal.getType()) {
|
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME));
|
||||||
Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.TAME));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(animal)) {
|
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(animal)) {
|
||||||
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
||||||
@ -1332,11 +1328,9 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (Jobs.getGCManager().payForStackedEntities) {
|
if (Jobs.getGCManager().payForStackedEntities) {
|
||||||
if (JobsHook.WildStacker.isEnabled() && HookManager.getWildStackerHandler().isStackedEntity(lVictim)) {
|
if (JobsHook.WildStacker.isEnabled()) {
|
||||||
for (com.bgsoftware.wildstacker.api.objects.StackedEntity stacked : HookManager.getWildStackerHandler().getStackedEntities()) {
|
for (int i = 0; i < HookManager.getWildStackerHandler().getEntityAmount(lVictim) - 1; i++) {
|
||||||
if (stacked.getType() == lVictim.getType()) {
|
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), e.getDamager(), lVictim);
|
||||||
Jobs.action(jDamager, new EntityActionInfo(stacked.getLivingEntity(), ActionType.KILL), e.getDamager(), stacked.getLivingEntity());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(lVictim)) {
|
} else if (JobsHook.StackMob.isEnabled() && HookManager.getStackMobHandler().isStacked(lVictim)) {
|
||||||
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
for (uk.antiperson.stackmob.entity.StackEntity stacked : HookManager.getStackMobHandler().getStackEntities()) {
|
||||||
|
@ -6,7 +6,7 @@ api-version: "1.13"
|
|||||||
website: https://www.spigotmc.org/resources/4216/
|
website: https://www.spigotmc.org/resources/4216/
|
||||||
authors: [Zrips, montlikadani]
|
authors: [Zrips, montlikadani]
|
||||||
depend: [CMILib]
|
depend: [CMILib]
|
||||||
softdepend: [Vault, Essentials, MythicMobs, McMMO, mcMMO, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants]
|
softdepend: [Vault, Essentials, MythicMobs, McMMO, mcMMO, WorldGuard, MyPet, PlaceholderAPI, EcoEnchants, WildStacker, StackMob]
|
||||||
commands:
|
commands:
|
||||||
jobs:
|
jobs:
|
||||||
description: Jobs
|
description: Jobs
|
||||||
|
Loading…
Reference in New Issue
Block a user