From 5817a74c67fc533474eb181b90e376a199605dc0 Mon Sep 17 00:00:00 2001 From: jakub1221 Date: Sat, 11 Feb 2017 12:21:17 +0100 Subject: [PATCH] Fixed startup crash --- README.md | 2 +- pom.xml | 8 +++++++- src/org/jakub1221/herobrineai/HerobrineAI.java | 8 +++++--- src/org/jakub1221/herobrineai/NPC/NPCCore.java | 16 +++++++++++----- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 990474f..b2941c9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # HerobrineAI -[![Build Status](http://jenkins.logicshard.com/job/HerobrineAI/1//badge/icon)](http://jenkins.logicshard.com/job/HerobrineAI/1/) +[![Build Status](http://jenkins.logicshard.com/buildStatus/icon?job=HerobrineAI)](http://jenkins.logicshard.com/job/HerobrineAI/) ========= diff --git a/pom.xml b/pom.xml index 6634091..572dbf0 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,12 @@ plugin.yml + + ${project.basedir} + + res/*.* + + @@ -141,7 +147,7 @@ 1.6 1.6 - + diff --git a/src/org/jakub1221/herobrineai/HerobrineAI.java b/src/org/jakub1221/herobrineai/HerobrineAI.java index ff73875..49986c4 100644 --- a/src/org/jakub1221/herobrineai/HerobrineAI.java +++ b/src/org/jakub1221/herobrineai/HerobrineAI.java @@ -81,13 +81,15 @@ public class HerobrineAI extends JavaPlugin implements Listener { isInitDone = false; } if (errorCheck) { + isInitDone = true; + HerobrineAI.pluginCore = this; - - NPCman = new NPCCore(this); - + this.configdb = new ConfigDB(log); + this.NPCman = new NPCCore(this); + getServer().getPluginManager().registerEvents(new EntityListener(this), this); getServer().getPluginManager().registerEvents(new BlockListener(), this); getServer().getPluginManager().registerEvents(new InventoryListener(), this); diff --git a/src/org/jakub1221/herobrineai/NPC/NPCCore.java b/src/org/jakub1221/herobrineai/NPC/NPCCore.java index cf60bbd..1ec659e 100644 --- a/src/org/jakub1221/herobrineai/NPC/NPCCore.java +++ b/src/org/jakub1221/herobrineai/NPC/NPCCore.java @@ -1,9 +1,7 @@ package org.jakub1221.herobrineai.NPC; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.UUID; @@ -40,9 +38,9 @@ public class NPCCore { public boolean isInLoaded = false; private int lastID = 0; - private static final GameProfile HEROBRINE_GAME_PROFILE = getHerobrineGameProfile(); + private GameProfile HerobrineGameProfile = getHerobrineGameProfile(); - private static GameProfile getHerobrineGameProfile() { + private GameProfile getHerobrineGameProfile() { GameProfile profile = new GameProfile( UUID.fromString(HerobrineAI.getPluginCore().getConfigDB().HerobrineUUID), HerobrineAI.getPluginCore().getConfigDB().HerobrineName @@ -58,6 +56,12 @@ public class NPCCore { } public NPCCore(JavaPlugin plugin) { + + server = BServer.getInstance(); + + networkCore = new NetworkCore(); + + Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(HerobrineAI.getPluginCore(), new Runnable() { @Override public void run() { @@ -73,6 +77,8 @@ public class NPCCore { } } }, 1L, 1L); + + this.HerobrineGameProfile = getHerobrineGameProfile(); } public void removeAll() { @@ -136,7 +142,7 @@ public class NPCCore { public HumanNPC spawnHumanNPC(String name, Location l, int id) { final BWorld world = server.getWorld(l.getWorld().getName()); - final HumanEntity humanEntity = new HumanEntity(this, world, HEROBRINE_GAME_PROFILE, new PlayerInteractManager(world.getWorldServer())); + final HumanEntity humanEntity = new HumanEntity(this, world, HerobrineGameProfile, new PlayerInteractManager(world.getWorldServer())); humanEntity.setLocation(l.getX(), l.getY(), l.getZ(), l.getYaw(), l.getPitch()); world.getWorldServer().addEntity(humanEntity); final HumanNPC humannpc = new HumanNPC(humanEntity, id);