added __on_start and defined better meta-events

This commit is contained in:
gnembon committed 2021-02-08 18:08:38 -04:00
1 parent 0a45778e4a
commit 4c09d6b736
8 files changed
+86 -22

No files matched your search

@@ -29,6 +29,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -300,6 +301,12 @@ public class CarpetScriptServer
// that will provide player hosts right at the startup
newHost.retrieveForExecution(source, null);
}
else
{
// global app - calling start now.
FunctionValue onStart = newHost.getFunction("__on_start");
if (onStart != null) newHost.callNow(onStart, Collections.emptyList());
}
long end = System.nanoTime();
CarpetSettings.LOG.info("App "+name+" loaded in "+(end-start)/1000000+" ms");
return true;