diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/Quest.java index 4b287a3480..e808b20176 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/Quest.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/Quest.java @@ -73,10 +73,7 @@ public class Quest extends ManagedScript private final String _prefixPath; // used only for admin_quest_reload private final String _descr; private final byte _initialState = State.CREATED; - // NOTE: questItemIds will be overriden by child classes. Ideally, it should be protected instead of public. - // However, quest scripts written in Jython will have trouble with protected, as Jython only knows private and public... - // In fact, protected will typically be considered private thus breaking the scripts. Leave this as public as a workaround. - public int[] questItemIds = null; + protected int[] questItemIds = null; // Dimensional Diamond Rewards by Class for 2nd class transfer quest (35) protected static final Map DF_REWARD_35 = new HashMap<>(); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestSpawn.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestSpawn.java index 4ea32748c1..506850dff9 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestSpawn.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestSpawn.java @@ -32,19 +32,8 @@ import org.l2jmobius.gameserver.model.spawn.Spawn; public class QuestSpawn { private final Logger LOGGER = Quest.LOGGER; - private static QuestSpawn instance; - public static QuestSpawn getInstance() - { - if (instance == null) - { - instance = new QuestSpawn(); - } - - return instance; - } - - public class DeSpawnScheduleTimerTask implements Runnable + private class DeSpawnScheduleTimerTask implements Runnable { NpcInstance _npc = null; @@ -149,4 +138,14 @@ public class QuestSpawn return null; } + + public static QuestSpawn getInstance() + { + return SingletonHolder.INSTANCE; + } + + private static class SingletonHolder + { + protected static final QuestSpawn INSTANCE = new QuestSpawn(); + } } diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestStateManager.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestStateManager.java deleted file mode 100644 index 2d93b0c01b..0000000000 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/QuestStateManager.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.quest; - -import java.util.ArrayList; -import java.util.List; - -import org.l2jmobius.commons.concurrent.ThreadPool; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; - -public class QuestStateManager -{ - public class ScheduleTimerTask implements Runnable - { - @Override - public void run() - { - try - { - cleanUp(); - ThreadPool.schedule(new ScheduleTimerTask(), 60000); - } - catch (Throwable t) - { - } - } - } - - private List _questStates = new ArrayList<>(); - - public QuestStateManager() - { - ThreadPool.schedule(new ScheduleTimerTask(), 60000); - } - - /** - * Add QuestState for the specified player instance - * @param quest - * @param player - * @param state - */ - public void addQuestState(Quest quest, PlayerInstance player, byte state) - { - QuestState qs = getQuestState(player); - if (qs == null) - { - qs = new QuestState(quest, player, state); - } - } - - /** - * Remove all QuestState for all player instance that does not exist - */ - public void cleanUp() - { - for (int i = getQuestStates().size() - 1; i >= 0; i--) - { - if (getQuestStates().get(i).getPlayer() == null) - { - removeQuestState(getQuestStates().get(i)); - getQuestStates().remove(i); - } - } - } - - /** - * Remove QuestState instance - * @param qs - */ - private void removeQuestState(QuestState qs) - { - qs = null; - } - - /** - * Return QuestState for specified player instance - * @param player - * @return - */ - public QuestState getQuestState(PlayerInstance player) - { - for (int i = 0; i < getQuestStates().size(); i++) - { - if ((getQuestStates().get(i).getPlayer() != null) && (getQuestStates().get(i).getPlayer().getObjectId() == player.getObjectId())) - { - return getQuestStates().get(i); - } - } - return null; - } - - /** - * Return all QuestState - * @return - */ - public List getQuestStates() - { - if (_questStates == null) - { - _questStates = new ArrayList<>(); - } - return _questStates; - } - - public static QuestStateManager getInstance() - { - return SingletonHolder.INSTANCE; - } - - private static class SingletonHolder - { - protected static final QuestStateManager INSTANCE = new QuestStateManager(); - } -} diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/State.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/State.java index 83f79ad579..6cb206ed48 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/State.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/quest/State.java @@ -17,7 +17,7 @@ package org.l2jmobius.gameserver.model.quest; /** - * @author Luis Arias Functions in this class are used in python files + * @author Luis Arias */ public class State {