mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Get rid of a second stack overflow
This commit is contained in:
parent
f64e28f2e8
commit
bd50e42c52
@ -128,7 +128,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,7 +125,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,17 +150,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault)) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,7 +161,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +176,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -124,7 +124,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -166,7 +166,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -148,7 +148,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,7 +157,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,7 +153,7 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,7 +156,7 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -122,7 +122,7 @@ public class PolarBearController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,7 +153,7 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,7 +146,7 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -169,7 +169,7 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -1801,8 +1802,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLeashed(NPC npc, EntityInsentient entity) {
|
||||
return NMS.isLeashed(npc, entity::isLeashed, () -> entity.unleash(true, false));
|
||||
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, EntityInsentient entity) {
|
||||
return NMS.isLeashed(npc, isLeashed, () -> entity.unleash(true, false));
|
||||
}
|
||||
|
||||
public static boolean isNavigationFinished(NavigationAbstract navigation) {
|
||||
|
@ -129,16 +129,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
|
||||
return super.isLeashed();
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +126,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,17 +151,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault)) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,7 +162,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -177,7 +177,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,7 +153,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -125,7 +125,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +150,7 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class EvokerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -117,7 +117,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class GuardianElderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,7 +160,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,7 +136,7 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -159,7 +159,7 @@ public class LlamaController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,7 +157,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,7 +157,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,7 +154,7 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,7 +155,7 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,16 +123,7 @@ public class PolarBearController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
|
||||
return super.isLeashed();
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,7 +154,7 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,7 +147,7 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,7 +146,7 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -157,7 +157,7 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,16 +114,7 @@ public class VexController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
|
||||
return super.isLeashed();
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -176,7 +176,7 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -147,7 +147,7 @@ public class VindicatorController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -116,7 +116,7 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +149,7 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class ZombieHuskController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -135,7 +135,7 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -16,6 +16,7 @@ import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -1867,8 +1868,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isLeashed(NPC npc, EntityInsentient entity) {
|
||||
return NMS.isLeashed(npc, entity::isLeashed, () -> entity.unleash(true, false));
|
||||
public static boolean isLeashed(NPC npc, Supplier<Boolean> isLeashed, EntityInsentient entity) {
|
||||
return NMS.isLeashed(npc, isLeashed, () -> entity.unleash(true, false));
|
||||
}
|
||||
|
||||
public static boolean isNavigationFinished(NavigationAbstract navigation) {
|
||||
|
@ -130,16 +130,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault))
|
||||
return super.isLeashed();
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,7 +127,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,17 +152,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
if (npc == null) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
boolean protectedDefault = npc.isProtected();
|
||||
if (!protectedDefault || !npc.data().get(NPC.Metadata.LEASH_PROTECTED, protectedDefault)) {
|
||||
return super.isLeashed();
|
||||
}
|
||||
if (super.isLeashed()) {
|
||||
unleash(true, false); // clearLeash with client update
|
||||
}
|
||||
return false; // shouldLeash
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -163,7 +163,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -178,7 +178,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -154,7 +154,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -126,7 +126,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +151,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -151,7 +151,7 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,7 +138,7 @@ public class EvokerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,7 +118,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -137,7 +137,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,7 +138,7 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -138,7 +138,7 @@ public class GuardianElderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -175,7 +175,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean isLeashed() {
|
||||
return NMSImpl.isLeashed(npc, this);
|
||||
return NMSImpl.isLeashed(npc, super::isLeashed, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user