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;
@@ -60,7 +59,6 @@ import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.network.serverpackets.StatusUpdate;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.scripting.ManagedScript;
import org.l2jmobius.gameserver.scripting.ScriptEngineManager;
/**
* @author Luis Arias
@@ -1763,12 +1761,6 @@ public class Quest extends ManagedScript
return null;
}
@Override
public Path getScriptPath()
{
return ScriptEngineManager.getInstance().getCurrentLoadingScript();
}
public QuestState getClanLeaderQuestState(Player player, Npc npc)
{
// If player is the leader, retrieves directly the qS and bypass others checks

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)