diff --git a/src/net/theprogrammersworld/herobrine/nms/NPC/NPCCore.java b/src/net/theprogrammersworld/herobrine/nms/NPC/NPCCore.java index b185ddf..193c8f6 100644 --- a/src/net/theprogrammersworld/herobrine/nms/NPC/NPCCore.java +++ b/src/net/theprogrammersworld/herobrine/nms/NPC/NPCCore.java @@ -1,5 +1,6 @@ package net.theprogrammersworld.herobrine.nms.NPC; +import java.io.File; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -17,6 +18,7 @@ import net.theprogrammersworld.herobrine.nms.NPC.utils.NMSWorldAccess; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.World; +import org.bukkit.configuration.file.YamlConfiguration; import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; @@ -26,7 +28,17 @@ public class NPCCore { private static final GameProfile HEROBRINE_GAME_PROFILE = getHerobrineGameProfile(); private static GameProfile getHerobrineGameProfile() { - GameProfile profile = new GameProfile(UUID.fromString(Herobrine.getPluginCore().getConfigDB().HerobrineUUID), Herobrine.getPluginCore().getConfigDB().HerobrineName); + // Get Herobrine's UUID and Name. We cannot rely on the ConfigDB because this constructor is called before the ConfigDB is initialized. + String herobrineUUID = "f84c6a79-0a4e-45e0-879b-cd49ebd4c4e2"; + String herobrineName = "Herobrine"; + YamlConfiguration configAccess = new YamlConfiguration(); + try { + configAccess.load(new File("plugins" + File.separator + "Herobrine" + File.separator + "config.yml")); + herobrineUUID = configAccess.getString("config.HerobrineUUID"); + herobrineName = configAccess.getString("config.Name"); + } catch (Exception e) {} + + GameProfile profile = new GameProfile(UUID.fromString(herobrineUUID), herobrineName); Property textures = new Property( "textures", "eyJ0aW1lc3RhbXAiOjE0MjE0ODczMzk3MTMsInByb2ZpbGVJZCI6ImY4NGM2YTc5MGE0ZTQ1ZTA4NzliY2Q0OWViZDRjNGUyIiwicHJvZmlsZU5hbWUiOiJIZXJvYnJpbmUiLCJpc1B1YmxpYyI6dHJ1ZSwidGV4dHVyZXMiOnsiU0tJTiI6eyJ1cmwiOiJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzk4YjdjYTNjN2QzMTRhNjFhYmVkOGZjMThkNzk3ZmMzMGI2ZWZjODQ0NTQyNWM0ZTI1MDk5N2U1MmU2Y2IifX19",