Skip to content

Commit

Permalink
[EXPERIMENTAL] Add a prestart event, for #1374
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Apr 3, 2016
1 parent 312ae9c commit e7586ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -870,12 +870,15 @@ public void run() {
try {
DenizenCore.loadScripts();

// Reload notables from notables.yml into memory
notableManager.reloadNotables();

// Load the saves.yml into memory
reloadSaves();

// Fire the 'on Pre Server Start' world event
ws_helper.serverPreStartEvent();

// Reload notables from notables.yml into memory
notableManager.reloadNotables();

dB.log(ChatColor.LIGHT_PURPLE + "+-------------------------+");

// Fire the 'on Server Start' world event
Expand Down
Expand Up @@ -75,7 +75,6 @@ public static String doEvents(List<String> events, dNPC npc, dPlayer player, Map
//
// -->
public void serverStartEvent() {
// Start the 'timeEvent'
long ticks = Settings.worldScriptTimeEventFrequency().getTicks();
Bukkit.getScheduler().scheduleSyncRepeatingTask(DenizenAPI.getCurrentInstance(),
new Runnable() {
Expand All @@ -94,6 +93,21 @@ public void run() {
}
}

// <--[event]
// @Events
// server prestart
//
// @Regex ^on server prestart$
//
// @Triggers before the server finishes starting... fired after saves are loaded, but before notables are loaded.
//
// -->
public void serverPreStartEvent() {
// Fire the 'Server Start' event
String determination = doEvents(Arrays.asList("server prestart"),
null, null, null);
}

private final Map<String, Integer> current_time = new HashMap<String, Integer>();

// <--[event]
Expand Down

0 comments on commit e7586ff

Please sign in to comment.