ManagedScript should store a copy of current loading script path.

This commit is contained in:
MobiusDevelopment
2022-08-01 00:07:12 +00:00
parent d278e64e5d
commit a2d4e16736
82 changed files with 82 additions and 390 deletions

View File

@@ -16,7 +16,6 @@
*/
package org.l2jmobius.gameserver.model.quest;
import java.nio.file.Path;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -76,7 +75,6 @@ import org.l2jmobius.gameserver.network.serverpackets.ActionFailed;
import org.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList;
import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.network.serverpackets.NpcQuestHtmlMessage;
import org.l2jmobius.gameserver.scripting.ScriptEngineManager;
import org.l2jmobius.gameserver.util.Util;
/**
@@ -2799,12 +2797,6 @@ public class Quest extends AbstractScript implements IIdentifiable
return getName();
}
@Override
public Path getScriptPath()
{
return ScriptEngineManager.getInstance().getCurrentLoadingScript();
}
@Override
public void setActive(boolean status)
{

View File

@@ -20,7 +20,6 @@ import java.nio.file.Path;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Abstract class for classes that are meant to be implemented by scripts.<br>
* @author KenM
@@ -35,12 +34,10 @@ public abstract class ManagedScript
public ManagedScript()
{
_scriptFile = getScriptPath();
_scriptFile = Path.of(ScriptEngineManager.getInstance().getCurrentLoadingScript().toUri());
setLastLoadTime(System.currentTimeMillis());
}
public abstract Path getScriptPath();
/**
* Attempts to reload this script and to refresh the necessary bindings with it ScriptControler.<br>
* Subclasses of this class should override this method to properly refresh their bindings when necessary.
@@ -50,7 +47,7 @@ public abstract class ManagedScript
{
try
{
ScriptEngineManager.getInstance().executeScript(getScriptFile());
ScriptEngineManager.getInstance().executeScript(_scriptFile);
return true;
}
catch (Exception e)