prevent events to be called when script server is gone.
This commit is contained in:
1 parent
566b6c394b
commit
bd689b418a
2 files changed
+3
-1
No files matched your search
@@ -103,6 +103,7 @@ public class CarpetEventServer
|
|||||||
runtimeArgs = new ArrayList<>(runtimeArgs);
|
runtimeArgs = new ArrayList<>(runtimeArgs);
|
||||||
runtimeArgs.addAll(this.parametrizedArgs);
|
runtimeArgs.addAll(this.parametrizedArgs);
|
||||||
}
|
}
|
||||||
|
if (CarpetServer.scriptServer == null) return false; // already stopped
|
||||||
return CarpetServer.scriptServer.runEventCall(
|
return CarpetServer.scriptServer.runEventCall(
|
||||||
sender.withLevel(CarpetSettings.runPermissionLevel),
|
sender.withLevel(CarpetSettings.runPermissionLevel),
|
||||||
host, optionalTarget, function, runtimeArgs
|
host, optionalTarget, function, runtimeArgs
|
||||||
|
|||||||
@@ -469,9 +469,10 @@ public class CarpetScriptServer
|
|||||||
public void onClose()
|
public void onClose()
|
||||||
{
|
{
|
||||||
CarpetEventServer.Event.SHUTDOWN.onTick();
|
CarpetEventServer.Event.SHUTDOWN.onTick();
|
||||||
for (ScriptHost host : modules.values())
|
for (CarpetScriptHost host : modules.values())
|
||||||
{
|
{
|
||||||
host.onClose();
|
host.onClose();
|
||||||
|
events.removeAllHostEvents(host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user