Should fix fakePlayer lookup NPE #546
I think it's safe to say that if the player is null here, the places we use this check should probably not continue. Will see how it goes. Also added the check to imperfect rituals and removed a redundant check from the dagger.
This commit is contained in:
parent
9aac50542b
commit
5ac78b2dea
|
@ -68,7 +68,7 @@ public class PlayerHelper
|
||||||
|
|
||||||
public static boolean isFakePlayer(EntityPlayer player)
|
public static boolean isFakePlayer(EntityPlayer player)
|
||||||
{
|
{
|
||||||
return player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(getUsernameFromPlayer(player)).matches();
|
return player != null && player instanceof FakePlayer || FAKE_PLAYER_PATTERN.matcher(getUsernameFromPlayer(player)).matches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void causeNauseaToPlayer(ItemStack stack)
|
public static void causeNauseaToPlayer(ItemStack stack)
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class ItemSacrificialDagger extends Item
|
||||||
for (int l = 0; l < 8; ++l)
|
for (int l = 0; l < 8; ++l)
|
||||||
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), f1, f2, f3);
|
||||||
|
|
||||||
if (!world.isRemote && PlayerHelper.isFakePlayer(player))
|
if (!world.isRemote)
|
||||||
return stack;
|
return stack;
|
||||||
|
|
||||||
// TODO - Check if SoulFray is active
|
// TODO - Check if SoulFray is active
|
||||||
|
|
|
@ -4,6 +4,7 @@ import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
|
||||||
import WayofTime.bloodmagic.api.ritual.imperfect.IImperfectRitualStone;
|
import WayofTime.bloodmagic.api.ritual.imperfect.IImperfectRitualStone;
|
||||||
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -19,8 +20,7 @@ public class TileImperfectRitualStone extends TileEntity implements IImperfectRi
|
||||||
@Override
|
@Override
|
||||||
public boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player)
|
public boolean performRitual(World world, BlockPos pos, ImperfectRitual imperfectRitual, EntityPlayer player)
|
||||||
{
|
{
|
||||||
|
if (!PlayerHelper.isFakePlayer(player) && imperfectRitual != null && ImperfectRitualRegistry.ritualEnabled(imperfectRitual))
|
||||||
if (imperfectRitual != null && ImperfectRitualRegistry.ritualEnabled(imperfectRitual))
|
|
||||||
{
|
{
|
||||||
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, imperfectRitual.getActivationCost());
|
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, imperfectRitual.getActivationCost());
|
||||||
if (imperfectRitual.onActivate(this, player))
|
if (imperfectRitual.onActivate(this, player))
|
||||||
|
|
Loading…
Reference in a new issue