Switch to Maven file structure

This commit is contained in:
P0nk
2021-03-30 21:07:35 +02:00
parent 4acc5675d6
commit 813643036b
817 changed files with 16 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public abstract class BaseTask implements Runnable {
protected World wserv;
@Override
public void run() {}
public BaseTask(World world) {
wserv = world;
}
}

View File

@@ -0,0 +1,33 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import server.expeditions.MapleExpeditionBossLog;
/**
* @author Ronan
*/
public class BossLogTask implements Runnable {
@Override
public void run() {
MapleExpeditionBossLog.resetBossLogTable();
}
}

View File

@@ -0,0 +1,47 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import config.YamlConfig;
import net.server.world.World;
import client.MapleCharacter;
import net.server.PlayerStorage;
/**
* @author Ronan
*/
public class CharacterAutosaverTask extends BaseTask implements Runnable { // thanks Alex09 (Alex-0000) for noticing these runnable classes are tasks, "workers" runs them
@Override
public void run() {
if(!YamlConfig.config.server.USE_AUTOSAVE) return;
PlayerStorage ps = wserv.getPlayerStorage();
for(MapleCharacter chr: ps.getAllCharacters()) {
if(chr != null && chr.isLoggedin()) {
chr.saveCharToDB(false);
}
}
}
public CharacterAutosaverTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,36 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.Server;
/**
* @author Ronan
* @info Thread responsible for announcing other players diseases when one enters into a map
*/
public class CharacterDiseaseTask implements Runnable {
@Override
public void run() {
Server serv = Server.getInstance();
serv.updateCurrentTime();
serv.runAnnouncePlayerDiseasesSchedule();
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import java.sql.SQLException;
import net.server.Server;
import tools.FilePrinter;
/**
* @author Ronan
* @info Thread responsible for maintaining coupons EXP & DROP effects active
*/
public class CouponTask implements Runnable {
@Override
public void run() {
try {
Server.getInstance().updateActiveCoupons();
Server.getInstance().commitActiveCoupons();
} catch(SQLException sqle) {
FilePrinter.printError(FilePrinter.EXCEPTION_CAUGHT, "Unexpected SQL error: " + sqle.getMessage());
}
}
}

View File

@@ -0,0 +1,35 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import client.processor.npc.DueyProcessor;
import client.processor.npc.FredrickProcessor;
/**
* @author Ronan
*/
public class DueyFredrickTask implements Runnable {
@Override
public void run() {
FredrickProcessor.runFredrickSchedule();
DueyProcessor.runDueyExpireSchedule();
}
}

View File

@@ -0,0 +1,34 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.coordinator.world.MapleEventRecallCoordinator;
/**
*
* @author Ronan
*/
public class EventRecallCoordinatorTask implements Runnable {
@Override
public void run() {
MapleEventRecallCoordinator.getInstance().manageEventInstances();
}
}

View File

@@ -0,0 +1,56 @@
package net.server.task;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Calendar;
import client.MapleFamily;
import net.server.world.World;
import tools.DatabaseConnection;
import tools.FilePrinter;
public class FamilyDailyResetTask implements Runnable {
private final World world;
public FamilyDailyResetTask(World world) {
this.world = world;
}
@Override
public void run() {
resetEntitlementUsage(world);
for(MapleFamily family : world.getFamilies()) {
family.resetDailyReps();
}
}
public static void resetEntitlementUsage(World world) {
Calendar resetTime = Calendar.getInstance();
resetTime.add(Calendar.MINUTE, 1); // to make sure that we're in the "next day", since this is called at midnight
resetTime.set(Calendar.HOUR_OF_DAY, 0);
resetTime.set(Calendar.MINUTE, 0);
resetTime.set(Calendar.SECOND, 0);
resetTime.set(Calendar.MILLISECOND, 0);
try(Connection con = DatabaseConnection.getConnection()) {
try(PreparedStatement ps = con.prepareStatement("UPDATE family_character SET todaysrep = 0, reptosenior = 0 WHERE lastresettime <= ?")) {
ps.setLong(1, resetTime.getTimeInMillis());
ps.executeUpdate();
} catch(SQLException e) {
FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not reset daily rep for families. On " + Calendar.getInstance().getTime());
e.printStackTrace();
}
try(PreparedStatement ps = con.prepareStatement("DELETE FROM family_entitlement WHERE timestamp <= ?")) {
ps.setLong(1, resetTime.getTimeInMillis());
ps.executeUpdate();
} catch(SQLException e) {
FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not do daily reset for family entitlements. On " + Calendar.getInstance().getTime());
e.printStackTrace();
}
} catch(SQLException e) {
FilePrinter.printError(FilePrinter.FAMILY_ERROR, e, "Could not get connection to DB.");
e.printStackTrace();
}
}
}

View File

@@ -0,0 +1,37 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class FishingTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runCheckFishingSchedule();
}
public FishingTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,37 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class HiredMerchantTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runHiredMerchantSchedule();
}
public HiredMerchantTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,33 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.coordinator.world.MapleInviteCoordinator;
/**
* @author Ronan
*/
public class InvitationTask implements Runnable {
@Override
public void run() {
MapleInviteCoordinator.runTimeoutSchedule();
}
}

View File

@@ -0,0 +1,34 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.coordinator.session.MapleSessionCoordinator;
/**
*
* @author Ronan
*/
public class LoginCoordinatorTask implements Runnable {
@Override
public void run() {
MapleSessionCoordinator.getInstance().runUpdateHwidHistory();
}
}

View File

@@ -0,0 +1,36 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.coordinator.session.MapleSessionCoordinator;
import net.server.coordinator.login.MapleLoginBypassCoordinator;
/**
*
* @author Ronan
*/
public class LoginStorageTask implements Runnable {
@Override
public void run() {
MapleSessionCoordinator.getInstance().runUpdateLoginHistory();
MapleLoginBypassCoordinator.getInstance().runUpdateLoginBypass();
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
import net.server.channel.Channel;
/**
* @author Ronan
*/
public class MapOwnershipTask extends BaseTask implements Runnable {
@Override
public void run() {
for (Channel ch : wserv.getChannels()) {
ch.runCheckOwnedMapsSchedule();
}
}
public MapOwnershipTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,37 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class MountTirednessTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runMountSchedule();
}
public MountTirednessTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,38 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
*
* @author Ronan
*/
public class PartySearchTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runPartySearchUpdateSchedule();
}
public PartySearchTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,37 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class PetFullnessTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runPetSchedule();
}
public PetFullnessTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,34 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.Server;
/**
*
* @author Ronan
*/
public class RankingCommandTask implements Runnable {
@Override
public void run() {
Server.getInstance().updateWorldPlayerRanking();
}
}

View File

@@ -0,0 +1,116 @@
/*
This file is part of the OdinMS Maple Story Server
Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
Matthias Butz <matze@odinms.de>
Jan Christian Meyer <vimes@odinms.de>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import client.MapleJob;
import config.YamlConfig;
import tools.DatabaseConnection;
import net.server.Server;
/**
* @author Matze
* @author Quit
* @author Ronan
*/
public class RankingLoginTask implements Runnable {
private Connection con;
private long lastUpdate = System.currentTimeMillis();
private void resetMoveRank(boolean job) throws SQLException {
String query = "UPDATE characters SET " + (job == true ? "jobRankMove = 0" : "rankMove = 0");
PreparedStatement reset = con.prepareStatement(query);
reset.executeUpdate();
}
private void updateRanking(int job, int world) throws SQLException {
String sqlCharSelect = "SELECT c.id, " + (job != -1 ? "c.jobRank, c.jobRankMove" : "c.rank, c.rankMove") + ", a.lastlogin AS lastlogin, a.loggedin FROM characters AS c LEFT JOIN accounts AS a ON c.accountid = a.id WHERE c.gm < 2 AND c.world = ? ";
if (job != -1) {
sqlCharSelect += "AND c.job DIV 100 = ? ";
}
sqlCharSelect += "ORDER BY c.level DESC , c.exp DESC , c.lastExpGainTime ASC, c.fame DESC , c.meso DESC";
PreparedStatement charSelect = con.prepareStatement(sqlCharSelect);
charSelect.setInt(1, world);
if (job != -1) {
charSelect.setInt(2, job);
}
ResultSet rs = charSelect.executeQuery();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (job != -1 ? "jobRank = ?, jobRankMove = ? " : "rank = ?, rankMove = ? ") + "WHERE id = ?");
int rank = 0;
while (rs.next()) {
int rankMove = 0;
rank++;
if (rs.getLong("lastlogin") < lastUpdate || rs.getInt("loggedin") > 0) {
rankMove = rs.getInt((job != -1 ? "jobRankMove" : "rankMove"));
}
rankMove += rs.getInt((job != -1 ? "jobRank" : "rank")) - rank;
ps.setInt(1, rank);
ps.setInt(2, rankMove);
ps.setInt(3, rs.getInt("id"));
ps.executeUpdate();
}
rs.close();
charSelect.close();
ps.close();
}
@Override
public void run() {
try {
con = DatabaseConnection.getConnection();
con.setAutoCommit(false);
if(YamlConfig.config.server.USE_REFRESH_RANK_MOVE == true) {
resetMoveRank(true);
resetMoveRank(false);
}
for(int j = 0; j < Server.getInstance().getWorldsSize(); j++) {
updateRanking(-1, j); //overall ranking
for (int i = 0; i <= MapleJob.getMax(); i++) {
updateRanking(i, j);
}
con.commit();
}
con.setAutoCommit(true);
lastUpdate = System.currentTimeMillis();
con.close();
} catch (SQLException ex) {
ex.printStackTrace();
try {
con.rollback();
con.setAutoCommit(true);
if(!con.isClosed()) con.close();
} catch (SQLException ex2) {
ex2.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,33 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.audit.LockCollector;
/**
* @author Ronan
* @info Thread responsible for expiring locks signalized for dispose.
*/
public class ReleaseLockTask implements Runnable {
@Override
public void run() {
LockCollector.getInstance().runLockCollector();
}
}

View File

@@ -0,0 +1,27 @@
package net.server.task;
import net.server.PlayerStorage;
import net.server.Server;
import net.server.channel.Channel;
import server.maps.MapleMapManager;
/**
* @author Resinate
*/
public class RespawnTask implements Runnable {
@Override
public void run() {
for (Channel ch : Server.getInstance().getAllChannels()) {
PlayerStorage ps = ch.getPlayerStorage();
if (ps != null) {
if (!ps.getAllCharacters().isEmpty()) {
MapleMapManager mapManager = ch.getMapFactory();
if (mapManager != null) {
mapManager.updateMaps();
}
}
}
}
}
}

View File

@@ -0,0 +1,40 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class ServerMessageTask extends BaseTask implements Runnable {
@Override
public void run() {
// It's purpose is for tracking whether the player client currently displays a boss HPBar and, if so,
// temporarily disable the server message for that player.
wserv.runDisabledServerMessagesSchedule();
}
public ServerMessageTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,37 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2016 - 2019 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import net.server.world.World;
/**
* @author Ronan
*/
public class TimedMapObjectTask extends BaseTask implements Runnable {
@Override
public void run() {
wserv.runTimedMapObjectSchedule();
}
public TimedMapObjectTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,30 @@
package net.server.task;
import client.MapleCharacter;
import config.YamlConfig;
import net.server.world.World;
import tools.FilePrinter;
import java.util.Collection;
/**
*
* @author Shavit
*/
public class TimeoutTask extends BaseTask implements Runnable {
@Override
public void run() {
long time = System.currentTimeMillis();
Collection<MapleCharacter> chars = wserv.getPlayerStorage().getAllCharacters();
for(MapleCharacter chr : chars) {
if(time - chr.getClient().getLastPacket() > YamlConfig.config.server.TIMEOUT_DURATION) {
FilePrinter.print(FilePrinter.DCS + chr.getClient().getAccountName(), chr.getName() + " auto-disconnected due to inactivity.");
chr.getClient().disconnect(true, chr.getCashShop().isOpened());
}
}
}
public TimeoutTask(World world) {
super(world);
}
}

View File

@@ -0,0 +1,56 @@
/*
This file is part of the HeavenMS MapleStory Server
Copyleft (L) 2017 RonanLana
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation version 3 as published by
the Free Software Foundation. You may not use, modify or distribute
this program under any other version of the GNU Affero General Public
License.
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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.server.task;
import java.util.Set;
import net.server.world.World;
import net.server.channel.Channel;
import tools.Pair;
/**
* @author Ronan
*/
public class WeddingReservationTask extends BaseTask implements Runnable {
@Override
public void run() {
for(Channel ch : wserv.getChannels()) {
Pair<Boolean, Pair<Integer, Set<Integer>>> wedding;
wedding = ch.getNextWeddingReservation(true); // start cathedral
if(wedding != null) {
ch.setOngoingWedding(true, wedding.getLeft(), wedding.getRight().getLeft(), wedding.getRight().getRight());
} else {
ch.setOngoingWedding(true, null, null, null);
}
wedding = ch.getNextWeddingReservation(false); // start chapel
if(wedding != null) {
ch.setOngoingWedding(false, wedding.getLeft(), wedding.getRight().getLeft(), wedding.getRight().getRight());
} else {
ch.setOngoingWedding(false, null, null, null);
}
}
}
public WeddingReservationTask(World world) {
super(world);
}
}