mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-30 21:07:48 +01:00
Fixing StackMob support
This commit is contained in:
parent
7954e62ae0
commit
339ec5be3e
@ -1,7 +1,5 @@
|
|||||||
package com.gamingmesh.jobs.hooks.stackMob;
|
package com.gamingmesh.jobs.hooks.stackMob;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
@ -14,8 +12,8 @@ public class StackMobHandler {
|
|||||||
return getPlugin().getEntityManager().isStackedEntity(entity);
|
return getPlugin().getEntityManager().isStackedEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<StackEntity> getStackEntities() {
|
public StackEntity getStackEntity(LivingEntity entity) {
|
||||||
return getPlugin().getEntityManager().getStackEntities();
|
return getPlugin().getEntityManager().getStackEntity(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public StackMob getPlugin() {
|
public StackMob getPlugin() {
|
||||||
|
@ -133,9 +133,11 @@ import net.Zrips.CMILib.Items.CMIItemStack;
|
|||||||
import net.Zrips.CMILib.Items.CMIMC;
|
import net.Zrips.CMILib.Items.CMIMC;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
import net.Zrips.CMILib.Locale.LC;
|
import net.Zrips.CMILib.Locale.LC;
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||||
|
import uk.antiperson.stackmob.entity.StackEntity;
|
||||||
|
|
||||||
public final class JobsPaymentListener implements Listener {
|
public final class JobsPaymentListener implements Listener {
|
||||||
|
|
||||||
@ -349,10 +351,11 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
Jobs.action(jDamager, new CustomKillInfo(sheep.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()) {
|
|
||||||
if (stacked.getEntity().getType() == sheep.getType()) {
|
StackEntity stack = HookManager.getStackMobHandler().getStackEntity(sheep);
|
||||||
Jobs.action(jDamager, new CustomKillInfo(((Sheep) stacked.getEntity()).getColor().name(), ActionType.SHEAR));
|
if (stack != null) {
|
||||||
}
|
Jobs.action(jDamager, new CustomKillInfo(sheep.getColor().name(), ActionType.SHEAR));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -615,10 +618,11 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME));
|
Jobs.action(jDamager, new EntityActionInfo(animal, 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()) {
|
|
||||||
if (stacked.getEntity().getType() == animal.getType()) {
|
StackEntity stack = HookManager.getStackMobHandler().getStackEntity(animal);
|
||||||
Jobs.action(jDamager, new EntityActionInfo(stacked.getEntity(), ActionType.TAME));
|
if (stack != null) {
|
||||||
}
|
Jobs.action(jDamager, new EntityActionInfo(animal, ActionType.TAME));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1407,10 +1411,10 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), killer, lVictim);
|
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), killer, lVictim);
|
||||||
}
|
}
|
||||||
} 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()) {
|
StackEntity stack = HookManager.getStackMobHandler().getStackEntity(lVictim);
|
||||||
if (stacked.getEntity().getType() == lVictim.getType()) {
|
if (stack != null) {
|
||||||
Jobs.action(jDamager, new EntityActionInfo(stacked.getEntity(), ActionType.KILL), killer, stacked.getEntity());
|
Jobs.action(jDamager, new EntityActionInfo(lVictim, ActionType.KILL), killer, lVictim);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user