Hook into new event ContextProvider

This commit is contained in:
fullwall 2012-04-12 23:01:56 +08:00
parent 0c5a0462b3
commit 9ab17fdf13
2 changed files with 11 additions and 1 deletions

View File

@ -11,6 +11,8 @@ import net.citizensnpcs.api.event.CitizensReloadEvent;
import net.citizensnpcs.api.exception.NPCException;
import net.citizensnpcs.api.exception.NPCLoadException;
import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.scripting.ScriptCompiler;
import net.citizensnpcs.api.trait.EventRegistrar;
import net.citizensnpcs.api.util.DataKey;
import net.citizensnpcs.api.util.DatabaseStorage;
import net.citizensnpcs.api.util.NBTStorage;
@ -177,6 +179,8 @@ public class Citizens extends JavaPlugin {
// Register commands
registerCommands();
registerScriptHelpers();
getServer().getScheduler().scheduleSyncRepeatingTask(this, new NPCUpdater(npcManager), 0, 1);
Messaging.log("v" + getDescription().getVersion() + " enabled.");
@ -222,6 +226,12 @@ public class Citizens extends JavaPlugin {
}.start();
}
private void registerScriptHelpers() {
ScriptCompiler compiler = CitizensAPI.getScriptCompiler();
compiler.registerGlobalContextProvider(new EventRegistrar(this));
}
private void registerCommands() {
commands.setInjector(new Injector(this));

View File

@ -10,7 +10,7 @@ import org.bukkit.conversations.StringPrompt;
import org.bukkit.entity.Player;
public class StartPrompt extends StringPrompt {
private Text text;
private final Text text;
public StartPrompt(Text text) {
this.text = text;