Rename and clean up MapleMapManager

This commit is contained in:
P0nk
2021-09-09 22:27:30 +02:00
parent 46842f9890
commit e917980a39
6 changed files with 24 additions and 24 deletions

View File

@@ -7114,7 +7114,7 @@ public class Character extends AbstractCharacterObject {
if (channelserver) {
MapleMapManager mapManager = client.getChannelServer().getMapFactory();
MapManager mapManager = client.getChannelServer().getMapFactory();
ret.map = mapManager.getMap(ret.mapid);
if (ret.map == null) {

View File

@@ -67,7 +67,7 @@ public final class Channel {
private PlayerStorage players = new PlayerStorage();
private ChannelServer channelServer;
private String serverMessage;
private MapleMapManager mapManager;
private MapManager mapManager;
private EventScriptManager eventSM;
private ServicesManager services;
private Map<Integer, HiredMerchant> hiredMerchants = new HashMap<>();
@@ -113,7 +113,7 @@ public final class Channel {
this.channel = channel;
this.ongoingStartTime = startTime + 10000; // rude approach to a world's last channel boot time, placeholder for the 1st wedding reservation ever
this.mapManager = new MapleMapManager(null, world, channel);
this.mapManager = new MapManager(null, world, channel);
this.port = BASE_PORT + (this.channel - 1) + (world * 100);
this.ip = YamlConfig.config.server.HOST + ":" + port;
@@ -246,7 +246,7 @@ public final class Channel {
}
}
public MapleMapManager getMapFactory() {
public MapManager getMapFactory() {
return mapManager;
}

View File

@@ -3,7 +3,7 @@ package net.server.task;
import net.server.PlayerStorage;
import net.server.Server;
import net.server.channel.Channel;
import server.maps.MapleMapManager;
import server.maps.MapManager;
/**
* @author Resinate
@@ -16,7 +16,7 @@ public class RespawnTask implements Runnable {
PlayerStorage ps = ch.getPlayerStorage();
if (ps != null) {
if (!ps.getAllCharacters().isEmpty()) {
MapleMapManager mapManager = ch.getMapFactory();
MapManager mapManager = ch.getMapFactory();
if (mapManager != null) {
mapManager.updateMaps();
}

View File

@@ -44,8 +44,8 @@ import server.expeditions.Expedition;
import server.life.LifeFactory;
import server.life.Monster;
import server.life.NPC;
import server.maps.MapManager;
import server.maps.MapleMap;
import server.maps.MapleMapManager;
import server.maps.MaplePortal;
import server.maps.MapleReactor;
import tools.PacketCreator;
@@ -71,7 +71,7 @@ public class EventInstanceManager {
private Map<Character, Integer> killCount = new HashMap<>();
private EventManager em;
private EventScriptScheduler ess;
private MapleMapManager mapManager;
private MapManager mapManager;
private String name;
private Properties props = new Properties();
private Map<String, Object> objectProps = new HashMap<>();
@@ -114,7 +114,7 @@ public class EventInstanceManager {
this.em = em;
this.name = name;
this.ess = new EventScriptScheduler();
this.mapManager = new MapleMapManager(this, em.getWorldServer().getId(), em.getChannelServer().getId());
this.mapManager = new MapManager(this, em.getWorldServer().getId(), em.getChannelServer().getId());
}
public void setName(String name) {
@@ -656,7 +656,7 @@ public class EventInstanceManager {
sL = sL.dispose();
}
public MapleMapManager getMapFactory() {
public MapManager getMapFactory() {
return mapManager;
}

View File

@@ -51,8 +51,8 @@ import server.gachapon.MapleGachapon;
import server.gachapon.MapleGachapon.MapleGachaponItem;
import server.life.LifeFactory;
import server.life.PlayerNPC;
import server.maps.MapManager;
import server.maps.MapleMap;
import server.maps.MapleMapManager;
import server.maps.MapleMapObject;
import server.maps.MapleMapObjectType;
import server.partyquest.AriantColiseum;
@@ -499,7 +499,7 @@ public class NPCConversationManager extends AbstractPlayerInteraction {
PyramidMode mod = PyramidMode.valueOf(mode);
Party partyz = getPlayer().getParty();
MapleMapManager mapManager = c.getChannelServer().getMapFactory();
MapManager mapManager = c.getChannelServer().getMapFactory();
MapleMap map = null;
int mapid = 926010100;

View File

@@ -30,17 +30,17 @@ import scripting.event.EventInstanceManager;
import java.util.HashMap;
import java.util.Map;
public class MapleMapManager {
private int channel, world;
public class MapManager {
private final int channel;
private final int world;
private EventInstanceManager event;
private Map<Integer, MapleMap> maps = new HashMap<>();
private MonitoredReadLock mapsRLock;
private MonitoredWriteLock mapsWLock;
public MapleMapManager(EventInstanceManager eim, int world, int channel) {
private final Map<Integer, MapleMap> maps = new HashMap<>();
private final MonitoredReadLock mapsRLock;
private final MonitoredWriteLock mapsWLock;
public MapManager(EventInstanceManager eim, int world, int channel) {
this.world = world;
this.channel = channel;
this.event = eim;
@@ -103,7 +103,7 @@ public class MapleMapManager {
return (map != null) ? map : loadMapFromWz(mapid, true);
}
public MapleMap getDisposableMap(int mapid) {
return loadMapFromWz(mapid, false);
}
@@ -125,14 +125,14 @@ public class MapleMapManager {
mapsRLock.unlock();
}
}
public void updateMaps() {
for (MapleMap map : getMaps().values()) {
map.respawn();
map.mobMpRecovery();
}
}
public void dispose() {
for (MapleMap map : getMaps().values()) {
map.dispose();