Fixed Sided issue in PlayerHelper - caused crashes in SMP.
This commit is contained in:
parent
71421b7d88
commit
1c75d4f648
|
@ -1,7 +1,9 @@
|
|||
package WayofTime.bloodmagic.api.util.helper;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
@ -9,6 +11,8 @@ import net.minecraft.potion.PotionEffect;
|
|||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -24,7 +28,7 @@ public class PlayerHelper
|
|||
|
||||
public static EntityPlayer getPlayerFromUsername(String username)
|
||||
{
|
||||
if (MinecraftServer.getServer() == null)
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
return null;
|
||||
|
||||
return MinecraftServer.getServer().getConfigurationManager().getPlayerByUsername(username);
|
||||
|
|
Loading…
Reference in a new issue