This commit is contained in:
@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2CubicInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.AutoAttackStop;
|
||||
|
||||
/**
|
||||
* Attack stance task manager.
|
||||
* @author Luca Baldi, Zoey76
|
||||
*/
|
||||
public class AttackStanceTaskManager
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(AttackStanceTaskManager.class.getName());
|
||||
|
||||
protected static final Map<L2Character, Long> _attackStanceTasks = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Instantiates a new attack stance task manager.
|
||||
*/
|
||||
protected AttackStanceTaskManager()
|
||||
{
|
||||
ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new FightModeScheduler(), 0, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the attack stance task.
|
||||
* @param actor the actor
|
||||
*/
|
||||
public void addAttackStanceTask(L2Character actor)
|
||||
{
|
||||
if (actor != null)
|
||||
{
|
||||
if (actor.isPlayable())
|
||||
{
|
||||
final L2PcInstance player = actor.getActingPlayer();
|
||||
for (L2CubicInstance cubic : player.getCubics().values())
|
||||
{
|
||||
if (cubic.getId() != L2CubicInstance.LIFE_CUBIC)
|
||||
{
|
||||
cubic.doAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
_attackStanceTasks.put(actor, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the attack stance task.
|
||||
* @param actor the actor
|
||||
*/
|
||||
public void removeAttackStanceTask(L2Character actor)
|
||||
{
|
||||
if (actor != null)
|
||||
{
|
||||
if (actor.isSummon())
|
||||
{
|
||||
actor = actor.getActingPlayer();
|
||||
}
|
||||
_attackStanceTasks.remove(actor);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for attack stance task.<br>
|
||||
* @param actor the actor
|
||||
* @return {@code true} if the character has an attack stance task, {@code false} otherwise
|
||||
*/
|
||||
public boolean hasAttackStanceTask(L2Character actor)
|
||||
{
|
||||
if (actor != null)
|
||||
{
|
||||
if (actor.isSummon())
|
||||
{
|
||||
actor = actor.getActingPlayer();
|
||||
}
|
||||
return _attackStanceTasks.containsKey(actor);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected class FightModeScheduler implements Runnable
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
long current = System.currentTimeMillis();
|
||||
try
|
||||
{
|
||||
final Iterator<Entry<L2Character, Long>> iter = _attackStanceTasks.entrySet().iterator();
|
||||
Entry<L2Character, Long> e;
|
||||
L2Character actor;
|
||||
while (iter.hasNext())
|
||||
{
|
||||
e = iter.next();
|
||||
if ((current - e.getValue()) > 15000)
|
||||
{
|
||||
actor = e.getKey();
|
||||
if (actor != null)
|
||||
{
|
||||
actor.broadcastPacket(new AutoAttackStop(actor.getObjectId()));
|
||||
actor.getAI().setAutoAttacking(false);
|
||||
if (actor.isPlayer() && actor.hasSummon())
|
||||
{
|
||||
actor.getSummon().broadcastPacket(new AutoAttackStop(actor.getSummon().getObjectId()));
|
||||
}
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Unless caught here, players remain in attack positions.
|
||||
_log.log(Level.WARNING, "Error in FightModeScheduler: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the single instance of AttackStanceTaskManager.
|
||||
* @return single instance of AttackStanceTaskManager
|
||||
*/
|
||||
public static AttackStanceTaskManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final AttackStanceTaskManager _instance = new AttackStanceTaskManager();
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
|
||||
/**
|
||||
* @author NosBit
|
||||
*/
|
||||
public final class DecayTaskManager
|
||||
{
|
||||
private final ScheduledExecutorService _decayExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
|
||||
protected final Map<L2Character, ScheduledFuture<?>> _decayTasks = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Adds a decay task for the specified character.<br>
|
||||
* <br>
|
||||
* If the decay task already exists it cancels it and re-adds it.
|
||||
* @param character the character
|
||||
*/
|
||||
public void add(L2Character character)
|
||||
{
|
||||
if (character == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long delay;
|
||||
if (character.getTemplate() instanceof L2NpcTemplate)
|
||||
{
|
||||
delay = ((L2NpcTemplate) character.getTemplate()).getCorpseTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
delay = Config.DEFAULT_CORPSE_TIME;
|
||||
}
|
||||
|
||||
if ((character instanceof L2Attackable) && (((L2Attackable) character).isSpoil() || ((L2Attackable) character).isSeeded()))
|
||||
{
|
||||
delay += Config.SPOILED_CORPSE_EXTEND_TIME;
|
||||
}
|
||||
|
||||
add(character, delay, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a decay task for the specified character.<br>
|
||||
* <br>
|
||||
* If the decay task already exists it cancels it and re-adds it.
|
||||
* @param character the character
|
||||
* @param delay the delay
|
||||
* @param timeUnit the time unit of the delay parameter
|
||||
*/
|
||||
public void add(L2Character character, long delay, TimeUnit timeUnit)
|
||||
{
|
||||
ScheduledFuture<?> decayTask = _decayExecutor.schedule(new DecayTask(character), delay, TimeUnit.SECONDS);
|
||||
|
||||
decayTask = _decayTasks.put(character, decayTask);
|
||||
// if decay task already existed cancel it so we use the new time
|
||||
if (decayTask != null)
|
||||
{
|
||||
if (!decayTask.cancel(false))
|
||||
{
|
||||
// old decay task was completed while canceling it remove and cancel the new one
|
||||
decayTask = _decayTasks.remove(character);
|
||||
if (decayTask != null)
|
||||
{
|
||||
decayTask.cancel(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancels the decay task of the specified character.
|
||||
* @param character the character
|
||||
*/
|
||||
public void cancel(L2Character character)
|
||||
{
|
||||
final ScheduledFuture<?> decayTask = _decayTasks.remove(character);
|
||||
if (decayTask != null)
|
||||
{
|
||||
decayTask.cancel(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the remaining time of the specified character's decay task.
|
||||
* @param character the character
|
||||
* @return if a decay task exists the remaining time, {@code Long.MAX_VALUE} otherwise
|
||||
*/
|
||||
public long getRemainingTime(L2Character character)
|
||||
{
|
||||
final ScheduledFuture<?> decayTask = _decayTasks.get(character);
|
||||
if (decayTask != null)
|
||||
{
|
||||
return decayTask.getDelay(TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
return Long.MAX_VALUE;
|
||||
}
|
||||
|
||||
private class DecayTask implements Runnable
|
||||
{
|
||||
private final L2Character _character;
|
||||
|
||||
protected DecayTask(L2Character character)
|
||||
{
|
||||
_character = character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_decayTasks.remove(_character);
|
||||
_character.onDecay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("============= DecayTask Manager Report ============");
|
||||
ret.append(Config.EOL);
|
||||
ret.append("Tasks count: ");
|
||||
ret.append(_decayTasks.size());
|
||||
ret.append(Config.EOL);
|
||||
ret.append("Tasks dump:");
|
||||
ret.append(Config.EOL);
|
||||
|
||||
for (Entry<L2Character, ScheduledFuture<?>> entry : _decayTasks.entrySet())
|
||||
{
|
||||
ret.append("Class/Name: ");
|
||||
ret.append(entry.getKey().getClass().getSimpleName());
|
||||
ret.append('/');
|
||||
ret.append(entry.getKey().getName());
|
||||
ret.append(" decay timer: ");
|
||||
ret.append(entry.getValue().getDelay(TimeUnit.MILLISECONDS));
|
||||
ret.append(Config.EOL);
|
||||
}
|
||||
|
||||
return ret.toString();
|
||||
}
|
||||
|
||||
public static DecayTaskManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final DecayTaskManager _instance = new DecayTaskManager();
|
||||
}
|
||||
}
|
@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javolution.util.FastSet;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.L2WorldRegion;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Playable;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GuardInstance;
|
||||
|
||||
public class KnownListUpdateTaskManager
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(KnownListUpdateTaskManager.class.getName());
|
||||
|
||||
private static final int FULL_UPDATE_TIMER = 100;
|
||||
public static boolean updatePass = true;
|
||||
|
||||
// Do full update every FULL_UPDATE_TIMER * KNOWNLIST_UPDATE_INTERVAL
|
||||
public static int _fullUpdateTimer = FULL_UPDATE_TIMER;
|
||||
|
||||
protected static final FastSet<L2WorldRegion> _failedRegions = new FastSet<>(1);
|
||||
|
||||
protected KnownListUpdateTaskManager()
|
||||
{
|
||||
ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new KnownListUpdate(), 1000, Config.KNOWNLIST_UPDATE_INTERVAL);
|
||||
}
|
||||
|
||||
private class KnownListUpdate implements Runnable
|
||||
{
|
||||
public KnownListUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
boolean failed;
|
||||
for (L2WorldRegion regions[] : L2World.getInstance().getWorldRegions())
|
||||
{
|
||||
for (L2WorldRegion r : regions) // go through all world regions
|
||||
{
|
||||
// avoid stopping update if something went wrong in updateRegion()
|
||||
try
|
||||
{
|
||||
failed = _failedRegions.contains(r); // failed on last pass
|
||||
if (r.isActive()) // and check only if the region is active
|
||||
{
|
||||
updateRegion(r, ((_fullUpdateTimer == FULL_UPDATE_TIMER) || failed), updatePass);
|
||||
}
|
||||
if (failed)
|
||||
{
|
||||
_failedRegions.remove(r); // if all ok, remove
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "KnownListUpdateTaskManager: updateRegion(" + _fullUpdateTimer + "," + updatePass + ") failed for region " + r.getName() + ". Full update scheduled. " + e.getMessage(), e);
|
||||
_failedRegions.add(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
updatePass = !updatePass;
|
||||
|
||||
if (_fullUpdateTimer > 0)
|
||||
{
|
||||
_fullUpdateTimer--;
|
||||
}
|
||||
else
|
||||
{
|
||||
_fullUpdateTimer = FULL_UPDATE_TIMER;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateRegion(L2WorldRegion region, boolean fullUpdate, boolean forgetObjects)
|
||||
{
|
||||
Collection<L2Object> vObj = region.getVisibleObjects().values();
|
||||
for (L2Object object : vObj) // and for all members in region
|
||||
{
|
||||
if ((object == null) || !object.isVisible())
|
||||
{
|
||||
continue; // skip dying objects
|
||||
}
|
||||
|
||||
// Some mobs need faster knownlist update
|
||||
final boolean aggro = (Config.GUARD_ATTACK_AGGRO_MOB && (object instanceof L2GuardInstance));
|
||||
|
||||
if (forgetObjects)
|
||||
{
|
||||
object.getKnownList().forgetObjects(aggro || fullUpdate);
|
||||
continue;
|
||||
}
|
||||
for (L2WorldRegion regi : region.getSurroundingRegions())
|
||||
{
|
||||
if ((object instanceof L2Playable) || (aggro && regi.isActive()) || fullUpdate)
|
||||
{
|
||||
Collection<L2Object> inrObj = regi.getVisibleObjects().values();
|
||||
for (L2Object obj : inrObj)
|
||||
{
|
||||
if (obj != object)
|
||||
{
|
||||
object.getKnownList().addKnownObject(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (object instanceof L2Character)
|
||||
{
|
||||
if (regi.isActive())
|
||||
{
|
||||
Collection<L2Object> inrPls = regi.getVisibleObjects().values();
|
||||
|
||||
for (L2Object obj : inrPls)
|
||||
{
|
||||
if (obj != object)
|
||||
{
|
||||
object.getKnownList().addKnownObject(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static KnownListUpdateTaskManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final KnownListUpdateTaskManager _instance = new KnownListUpdateTaskManager();
|
||||
}
|
||||
}
|
50
trunk/java/com/l2jserver/gameserver/taskmanager/Task.java
Normal file
50
trunk/java/com/l2jserver/gameserver/taskmanager/Task.java
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public abstract class Task
|
||||
{
|
||||
protected final Logger _log = Logger.getLogger(getClass().getName());
|
||||
|
||||
public void initializate()
|
||||
{
|
||||
}
|
||||
|
||||
public ScheduledFuture<?> launchSpecial(ExecutedTask instance)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract void onTimeElapsed(ExecutedTask task);
|
||||
|
||||
public void onDestroy()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
397
trunk/java/com/l2jserver/gameserver/taskmanager/TaskManager.java
Normal file
397
trunk/java/com/l2jserver/gameserver/taskmanager/TaskManager.java
Normal file
@ -0,0 +1,397 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
import static com.l2jserver.gameserver.taskmanager.TaskTypes.TYPE_NONE;
|
||||
import static com.l2jserver.gameserver.taskmanager.TaskTypes.TYPE_SHEDULED;
|
||||
import static com.l2jserver.gameserver.taskmanager.TaskTypes.TYPE_TIME;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javolution.util.FastList;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskBirthday;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskClanLeaderApply;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskCleanUp;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskDailySkillReuseClean;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskGlobalVariablesSave;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskJython;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskOlympiadSave;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskRaidPointsReset;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskRecom;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskRestart;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskScript;
|
||||
import com.l2jserver.gameserver.taskmanager.tasks.TaskShutdown;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public final class TaskManager
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(TaskManager.class.getName());
|
||||
|
||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
||||
protected final List<ExecutedTask> _currentTasks = new FastList<ExecutedTask>().shared();
|
||||
|
||||
protected static final String[] SQL_STATEMENTS =
|
||||
{
|
||||
"SELECT id,task,type,last_activation,param1,param2,param3 FROM global_tasks",
|
||||
"UPDATE global_tasks SET last_activation=? WHERE id=?",
|
||||
"SELECT id FROM global_tasks WHERE task=?",
|
||||
"INSERT INTO global_tasks (task,type,last_activation,param1,param2,param3) VALUES(?,?,?,?,?,?)"
|
||||
};
|
||||
|
||||
protected TaskManager()
|
||||
{
|
||||
initializate();
|
||||
startAllTasks();
|
||||
_log.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _tasks.size() + " Tasks");
|
||||
}
|
||||
|
||||
public class ExecutedTask implements Runnable
|
||||
{
|
||||
int id;
|
||||
long lastActivation;
|
||||
Task task;
|
||||
TaskTypes type;
|
||||
String[] params;
|
||||
ScheduledFuture<?> scheduled;
|
||||
|
||||
public ExecutedTask(Task ptask, TaskTypes ptype, ResultSet rset) throws SQLException
|
||||
{
|
||||
task = ptask;
|
||||
type = ptype;
|
||||
id = rset.getInt("id");
|
||||
lastActivation = rset.getLong("last_activation");
|
||||
params = new String[]
|
||||
{
|
||||
rset.getString("param1"),
|
||||
rset.getString("param2"),
|
||||
rset.getString("param3")
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
task.onTimeElapsed(this);
|
||||
lastActivation = System.currentTimeMillis();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
|
||||
{
|
||||
statement.setLong(1, lastActivation);
|
||||
statement.setInt(2, id);
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Cannot updated the Global Task " + id + ": " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
if ((type == TYPE_SHEDULED) || (type == TYPE_TIME))
|
||||
{
|
||||
stopTask();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object)
|
||||
{
|
||||
if (this == object)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (!(object instanceof ExecutedTask))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return id == ((ExecutedTask) object).id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Task getTask()
|
||||
{
|
||||
return task;
|
||||
}
|
||||
|
||||
public TaskTypes getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public String[] getParams()
|
||||
{
|
||||
return params;
|
||||
}
|
||||
|
||||
public long getLastActivation()
|
||||
{
|
||||
return lastActivation;
|
||||
}
|
||||
|
||||
public void stopTask()
|
||||
{
|
||||
task.onDestroy();
|
||||
|
||||
if (scheduled != null)
|
||||
{
|
||||
scheduled.cancel(true);
|
||||
}
|
||||
|
||||
_currentTasks.remove(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initializate()
|
||||
{
|
||||
registerTask(new TaskBirthday());
|
||||
registerTask(new TaskClanLeaderApply());
|
||||
registerTask(new TaskCleanUp());
|
||||
registerTask(new TaskDailySkillReuseClean());
|
||||
registerTask(new TaskGlobalVariablesSave());
|
||||
registerTask(new TaskJython());
|
||||
registerTask(new TaskOlympiadSave());
|
||||
registerTask(new TaskRaidPointsReset());
|
||||
registerTask(new TaskRecom());
|
||||
registerTask(new TaskRestart());
|
||||
registerTask(new TaskScript());
|
||||
registerTask(new TaskShutdown());
|
||||
}
|
||||
|
||||
public void registerTask(Task task)
|
||||
{
|
||||
int key = task.getName().hashCode();
|
||||
_tasks.computeIfAbsent(key, k ->
|
||||
{
|
||||
task.initializate();
|
||||
return task;
|
||||
});
|
||||
}
|
||||
|
||||
private void startAllTasks()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
|
||||
ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
Task task = _tasks.get(rset.getString("task").trim().toLowerCase().hashCode());
|
||||
if (task == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final TaskTypes type = TaskTypes.valueOf(rset.getString("type"));
|
||||
if (type != TYPE_NONE)
|
||||
{
|
||||
ExecutedTask current = new ExecutedTask(task, type, rset);
|
||||
if (launchTask(current))
|
||||
{
|
||||
_currentTasks.add(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, getClass().getSimpleName() + ": Error while loading Global Task table: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean launchTask(ExecutedTask task)
|
||||
{
|
||||
final ThreadPoolManager scheduler = ThreadPoolManager.getInstance();
|
||||
final TaskTypes type = task.getType();
|
||||
long delay, interval;
|
||||
switch (type)
|
||||
{
|
||||
case TYPE_STARTUP:
|
||||
task.run();
|
||||
return false;
|
||||
case TYPE_SHEDULED:
|
||||
delay = Long.valueOf(task.getParams()[0]);
|
||||
task.scheduled = scheduler.scheduleGeneral(task, delay);
|
||||
return true;
|
||||
case TYPE_FIXED_SHEDULED:
|
||||
delay = Long.valueOf(task.getParams()[0]);
|
||||
interval = Long.valueOf(task.getParams()[1]);
|
||||
task.scheduled = scheduler.scheduleGeneralAtFixedRate(task, delay, interval);
|
||||
return true;
|
||||
case TYPE_TIME:
|
||||
try
|
||||
{
|
||||
Date desired = DateFormat.getInstance().parse(task.getParams()[0]);
|
||||
long diff = desired.getTime() - System.currentTimeMillis();
|
||||
if (diff >= 0)
|
||||
{
|
||||
task.scheduled = scheduler.scheduleGeneral(task, diff);
|
||||
return true;
|
||||
}
|
||||
_log.info(getClass().getSimpleName() + ": Task " + task.getId() + " is obsoleted.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
break;
|
||||
case TYPE_SPECIAL:
|
||||
ScheduledFuture<?> result = task.getTask().launchSpecial(task);
|
||||
if (result != null)
|
||||
{
|
||||
task.scheduled = result;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case TYPE_GLOBAL_TASK:
|
||||
interval = Long.valueOf(task.getParams()[0]) * 86400000L;
|
||||
String[] hour = task.getParams()[1].split(":");
|
||||
|
||||
if (hour.length != 3)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Task " + task.getId() + " has incorrect parameters");
|
||||
return false;
|
||||
}
|
||||
|
||||
Calendar check = Calendar.getInstance();
|
||||
check.setTimeInMillis(task.getLastActivation() + interval);
|
||||
|
||||
Calendar min = Calendar.getInstance();
|
||||
try
|
||||
{
|
||||
min.set(Calendar.HOUR_OF_DAY, Integer.parseInt(hour[0]));
|
||||
min.set(Calendar.MINUTE, Integer.parseInt(hour[1]));
|
||||
min.set(Calendar.SECOND, Integer.parseInt(hour[2]));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Bad parameter on task " + task.getId() + ": " + e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
|
||||
delay = min.getTimeInMillis() - System.currentTimeMillis();
|
||||
|
||||
if (check.after(min) || (delay < 0))
|
||||
{
|
||||
delay += interval;
|
||||
}
|
||||
task.scheduled = scheduler.scheduleGeneralAtFixedRate(task, delay, interval);
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3)
|
||||
{
|
||||
return addUniqueTask(task, type, param1, param2, param3, 0);
|
||||
}
|
||||
|
||||
public static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
|
||||
{
|
||||
ps1.setString(1, task);
|
||||
try (ResultSet rs = ps1.executeQuery())
|
||||
{
|
||||
if (!rs.next())
|
||||
{
|
||||
try (PreparedStatement ps2 = con.prepareStatement(SQL_STATEMENTS[3]))
|
||||
{
|
||||
ps2.setString(1, task);
|
||||
ps2.setString(2, type.toString());
|
||||
ps2.setLong(3, lastActivation);
|
||||
ps2.setString(4, param1);
|
||||
ps2.setString(5, param2);
|
||||
ps2.setString(6, param3);
|
||||
ps2.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the unique task: " + e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3)
|
||||
{
|
||||
return addTask(task, type, param1, param2, param3, 0);
|
||||
}
|
||||
|
||||
public static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
|
||||
{
|
||||
statement.setString(1, task);
|
||||
statement.setString(2, type.toString());
|
||||
statement.setLong(3, lastActivation);
|
||||
statement.setString(4, param1);
|
||||
statement.setString(5, param2);
|
||||
statement.setString(6, param3);
|
||||
statement.execute();
|
||||
return true;
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, TaskManager.class.getSimpleName() + ": Cannot add the task: " + e.getMessage(), e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static TaskManager getInstance()
|
||||
{
|
||||
return SingletonHolder._instance;
|
||||
}
|
||||
|
||||
private static class SingletonHolder
|
||||
{
|
||||
protected static final TaskManager _instance = new TaskManager();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public enum TaskTypes
|
||||
{
|
||||
TYPE_NONE,
|
||||
TYPE_TIME,
|
||||
TYPE_SHEDULED,
|
||||
TYPE_FIXED_SHEDULED,
|
||||
TYPE_GLOBAL_TASK,
|
||||
TYPE_STARTUP,
|
||||
TYPE_SPECIAL
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.datatables.CharNameTable;
|
||||
import com.l2jserver.gameserver.instancemanager.MailManager;
|
||||
import com.l2jserver.gameserver.model.entity.Message;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Mail;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* @author Nyaran
|
||||
*/
|
||||
public class TaskBirthday extends Task
|
||||
{
|
||||
private static final String NAME = "birthday";
|
||||
private static final String QUERY = "SELECT charId, createDate FROM characters WHERE createDate LIKE ?";
|
||||
private static final Calendar _today = Calendar.getInstance();
|
||||
private int _count = 0;
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
Calendar lastExecDate = Calendar.getInstance();
|
||||
long lastActivation = task.getLastActivation();
|
||||
|
||||
if (lastActivation > 0)
|
||||
{
|
||||
lastExecDate.setTimeInMillis(lastActivation);
|
||||
}
|
||||
|
||||
String rangeDate = "[" + Util.getDateString(lastExecDate.getTime()) + "] - [" + Util.getDateString(_today.getTime()) + "]";
|
||||
|
||||
for (; !_today.before(lastExecDate); lastExecDate.add(Calendar.DATE, 1))
|
||||
{
|
||||
checkBirthday(lastExecDate.get(Calendar.YEAR), lastExecDate.get(Calendar.MONTH), lastExecDate.get(Calendar.DATE));
|
||||
}
|
||||
|
||||
_log.info("BirthdayManager: " + _count + " gifts sent. " + rangeDate);
|
||||
}
|
||||
|
||||
private void checkBirthday(int year, int month, int day)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(QUERY))
|
||||
{
|
||||
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
int playerId = rset.getInt("charId");
|
||||
Calendar createDate = Calendar.getInstance();
|
||||
createDate.setTime(rset.getDate("createDate"));
|
||||
|
||||
int age = year - createDate.get(Calendar.YEAR);
|
||||
if (age <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String text = Config.ALT_BIRTHDAY_MAIL_TEXT;
|
||||
|
||||
if (text.contains("$c1"))
|
||||
{
|
||||
text = text.replace("$c1", CharNameTable.getInstance().getNameById(playerId));
|
||||
}
|
||||
if (text.contains("$s1"))
|
||||
{
|
||||
text = text.replace("$s1", String.valueOf(age));
|
||||
}
|
||||
|
||||
Message msg = new Message(playerId, Config.ALT_BIRTHDAY_MAIL_SUBJECT, text, Message.SendBySystem.ALEGRIA);
|
||||
|
||||
Mail attachments = msg.createAttachments();
|
||||
attachments.addItem("Birthday", Config.ALT_BIRTHDAY_GIFT, 1, null, null);
|
||||
|
||||
MailManager.getInstance().sendMessage(msg);
|
||||
_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Error checking birthdays. ", e);
|
||||
}
|
||||
|
||||
// If character birthday is 29-Feb and year isn't leap, send gift on 28-feb
|
||||
GregorianCalendar calendar = new GregorianCalendar();
|
||||
if ((month == Calendar.FEBRUARY) && (day == 28) && !calendar.isLeapYear(_today.get(Calendar.YEAR)))
|
||||
{
|
||||
checkBirthday(year, Calendar.FEBRUARY, 29);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param num the number to format.
|
||||
* @return the formatted number starting with a 0 if it is lower or equal than 10.
|
||||
*/
|
||||
private String getNum(int num)
|
||||
{
|
||||
return (num <= 9) ? "0" + num : String.valueOf(num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", "06:30:00", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.ClanTable;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2ClanMember;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class TaskClanLeaderApply extends Task
|
||||
{
|
||||
private static final String NAME = "clanleaderapply";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (cal.get(Calendar.DAY_OF_WEEK) == Config.ALT_CLAN_LEADER_DATE_CHANGE)
|
||||
{
|
||||
for (L2Clan clan : ClanTable.getInstance().getClans())
|
||||
{
|
||||
if (clan.getNewLeaderId() != 0)
|
||||
{
|
||||
final L2ClanMember member = clan.getClanMember(clan.getNewLeaderId());
|
||||
if (member == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
clan.setNewLeader(member);
|
||||
}
|
||||
}
|
||||
_log.info(getClass().getSimpleName() + ": launched.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", Config.ALT_CLAN_LEADER_HOUR_CHANGE, "");
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author Tempy
|
||||
*/
|
||||
public final class TaskCleanUp extends Task
|
||||
{
|
||||
public static final String NAME = "clean_up";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
System.runFinalization();
|
||||
System.gc();
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
public class TaskDailySkillReuseClean extends Task
|
||||
{
|
||||
private static final String NAME = "daily_skill_clean";
|
||||
|
||||
private static final int[] _daily_skills =
|
||||
{
|
||||
2510,
|
||||
22180
|
||||
};
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
for (int skill_id : _daily_skills)
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_skills_save WHERE skill_id=?;"))
|
||||
{
|
||||
ps.setInt(1, skill_id);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.severe(getClass().getSimpleName() + ": Could not reset daily skill reuse: " + e);
|
||||
}
|
||||
_log.info("Daily skill reuse cleaned.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", "06:30:00", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.GlobalVariablesManager;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
/**
|
||||
* @author Gigiikun
|
||||
*/
|
||||
public class TaskGlobalVariablesSave extends Task
|
||||
{
|
||||
public static final String NAME = "global_varibales_save";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
GlobalVariablesManager.getInstance().storeMe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_FIXED_SHEDULED, "500000", "1800000", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import org.python.util.PythonInterpreter;
|
||||
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public class TaskJython extends Task
|
||||
{
|
||||
public static final String NAME = "jython";
|
||||
private final PythonInterpreter _python = new PythonInterpreter();
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
_python.cleanup();
|
||||
_python.exec("import sys");
|
||||
_python.execfile("data/scripts/cron/" + task.getParams()[2]);
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import com.l2jserver.gameserver.model.olympiad.Olympiad;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
/**
|
||||
* Updates all data of Olympiad nobles in db
|
||||
* @author godson
|
||||
*/
|
||||
public class TaskOlympiadSave extends Task
|
||||
{
|
||||
public static final String NAME = "olympiad_save";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
if (Olympiad.getInstance().inCompPeriod())
|
||||
{
|
||||
Olympiad.getInstance().saveOlympiadStatus();
|
||||
_log.info("Olympiad System: Data updated.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_FIXED_SHEDULED, "900000", "1800000", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.datatables.ClanTable;
|
||||
import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
public class TaskRaidPointsReset extends Task
|
||||
{
|
||||
public static final String NAME = "raid_points_reset";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY)
|
||||
{
|
||||
// reward clan reputation points
|
||||
Map<Integer, Integer> rankList = RaidBossPointsManager.getInstance().getRankList();
|
||||
for (L2Clan c : ClanTable.getInstance().getClans())
|
||||
{
|
||||
for (Map.Entry<Integer, Integer> entry : rankList.entrySet())
|
||||
{
|
||||
if ((entry.getValue() <= 100) && c.isMember(entry.getKey()))
|
||||
{
|
||||
int reputation = 0;
|
||||
switch (entry.getValue())
|
||||
{
|
||||
case 1:
|
||||
reputation = Config.RAID_RANKING_1ST;
|
||||
break;
|
||||
case 2:
|
||||
reputation = Config.RAID_RANKING_2ND;
|
||||
break;
|
||||
case 3:
|
||||
reputation = Config.RAID_RANKING_3RD;
|
||||
break;
|
||||
case 4:
|
||||
reputation = Config.RAID_RANKING_4TH;
|
||||
break;
|
||||
case 5:
|
||||
reputation = Config.RAID_RANKING_5TH;
|
||||
break;
|
||||
case 6:
|
||||
reputation = Config.RAID_RANKING_6TH;
|
||||
break;
|
||||
case 7:
|
||||
reputation = Config.RAID_RANKING_7TH;
|
||||
break;
|
||||
case 8:
|
||||
reputation = Config.RAID_RANKING_8TH;
|
||||
break;
|
||||
case 9:
|
||||
reputation = Config.RAID_RANKING_9TH;
|
||||
break;
|
||||
case 10:
|
||||
reputation = Config.RAID_RANKING_10TH;
|
||||
break;
|
||||
default:
|
||||
if (entry.getValue() <= 50)
|
||||
{
|
||||
reputation = Config.RAID_RANKING_UP_TO_50TH;
|
||||
}
|
||||
else
|
||||
{
|
||||
reputation = Config.RAID_RANKING_UP_TO_100TH;
|
||||
}
|
||||
break;
|
||||
}
|
||||
c.addReputationScore(reputation, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RaidBossPointsManager.getInstance().cleanUp();
|
||||
_log.info("Raid Points Reset Global Task: launched.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", "00:10:00", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskTypes;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public class TaskRecom extends Task
|
||||
{
|
||||
private static final String NAME = "recommendations";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left=?, time_left=?, rec_have=0 WHERE rec_have <= 20"))
|
||||
{
|
||||
ps.setInt(1, 0); // Rec left = 0
|
||||
ps.setInt(2, 3600000); // Timer = 1 hour
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left=?, time_left=?, rec_have=GREATEST(rec_have-20,0) WHERE rec_have > 20"))
|
||||
{
|
||||
ps.setInt(1, 0); // Rec left = 0
|
||||
ps.setInt(2, 3600000); // Timer = 1 hour
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.severe(getClass().getSimpleName() + ": Could not reset Recommendations System: " + e);
|
||||
}
|
||||
_log.info("Recommendations System reseted");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializate()
|
||||
{
|
||||
super.initializate();
|
||||
TaskManager.addUniqueTask(NAME, TaskTypes.TYPE_GLOBAL_TASK, "1", "06:30:00", "");
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import com.l2jserver.gameserver.Shutdown;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public final class TaskRestart extends Task
|
||||
{
|
||||
public static final String NAME = "restart";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
Shutdown handler = new Shutdown(Integer.parseInt(task.getParams()[2]), true);
|
||||
handler.start();
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author janiii
|
||||
*/
|
||||
public class TaskScript extends Task
|
||||
{
|
||||
public static final String NAME = "script";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
final File file = new File(L2ScriptEngineManager.SCRIPT_FOLDER, "cron/" + task.getParams()[2]);
|
||||
if (file.isFile())
|
||||
{
|
||||
try
|
||||
{
|
||||
L2ScriptEngineManager.getInstance().executeScript(file);
|
||||
}
|
||||
catch (ScriptException e)
|
||||
{
|
||||
_log.warning("Failed loading: " + task.getParams()[2]);
|
||||
L2ScriptEngineManager.getInstance().reportScriptFileError(file, e);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("Failed loading: " + task.getParams()[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("File Not Found: " + task.getParams()[2]);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2014 L2J Server
|
||||
*
|
||||
* This file is part of L2J Server.
|
||||
*
|
||||
* L2J Server 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.
|
||||
*
|
||||
* L2J Server 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.gameserver.taskmanager.tasks;
|
||||
|
||||
import com.l2jserver.gameserver.Shutdown;
|
||||
import com.l2jserver.gameserver.taskmanager.Task;
|
||||
import com.l2jserver.gameserver.taskmanager.TaskManager.ExecutedTask;
|
||||
|
||||
/**
|
||||
* @author Layane
|
||||
*/
|
||||
public class TaskShutdown extends Task
|
||||
{
|
||||
public static final String NAME = "shutdown";
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeElapsed(ExecutedTask task)
|
||||
{
|
||||
Shutdown handler = new Shutdown(Integer.parseInt(task.getParams()[2]), false);
|
||||
handler.start();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user