Rename and clean up MapleGenericPortal
This commit is contained in:
@@ -32,20 +32,19 @@ import tools.PacketCreator;
|
|||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class MapleGenericPortal implements MaplePortal {
|
public class GenericPortal implements MaplePortal {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String target;
|
private String target;
|
||||||
private Point position;
|
private Point position;
|
||||||
private int targetmap;
|
private int targetmap;
|
||||||
private int type;
|
private final int type;
|
||||||
private boolean status = true;
|
private boolean status = true;
|
||||||
private int id;
|
private int id;
|
||||||
private String scriptName;
|
private String scriptName;
|
||||||
private boolean portalState;
|
private boolean portalState;
|
||||||
private MonitoredReentrantLock scriptLock = null;
|
private MonitoredReentrantLock scriptLock = null;
|
||||||
|
|
||||||
public MapleGenericPortal(int type) {
|
public GenericPortal(int type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +117,8 @@ public class MapleGenericPortal implements MaplePortal {
|
|||||||
public void setScriptName(String scriptName) {
|
public void setScriptName(String scriptName) {
|
||||||
this.scriptName = scriptName;
|
this.scriptName = scriptName;
|
||||||
|
|
||||||
if(scriptName != null) {
|
if (scriptName != null) {
|
||||||
if(scriptLock == null) {
|
if (scriptLock == null) {
|
||||||
scriptLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.PORTAL, true);
|
scriptLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.PORTAL, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -138,7 +137,7 @@ public class MapleGenericPortal implements MaplePortal {
|
|||||||
} finally {
|
} finally {
|
||||||
scriptLock.unlock();
|
scriptLock.unlock();
|
||||||
}
|
}
|
||||||
} catch(NullPointerException npe) {
|
} catch (NullPointerException npe) {
|
||||||
npe.printStackTrace();
|
npe.printStackTrace();
|
||||||
}
|
}
|
||||||
} else if (getTargetMapId() != 999999999) {
|
} else if (getTargetMapId() != 999999999) {
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
package server.maps;
|
package server.maps;
|
||||||
|
|
||||||
public class MapleMapPortal extends MapleGenericPortal {
|
public class MapleMapPortal extends GenericPortal {
|
||||||
public MapleMapPortal() {
|
public MapleMapPortal() {
|
||||||
super(MaplePortal.MAP_PORTAL);
|
super(MaplePortal.MAP_PORTAL);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,17 +34,17 @@ public class MaplePortalFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public MaplePortal makePortal(int type, Data portal) {
|
public MaplePortal makePortal(int type, Data portal) {
|
||||||
MapleGenericPortal ret = null;
|
GenericPortal ret = null;
|
||||||
if (type == MaplePortal.MAP_PORTAL) {
|
if (type == MaplePortal.MAP_PORTAL) {
|
||||||
ret = new MapleMapPortal();
|
ret = new MapleMapPortal();
|
||||||
} else {
|
} else {
|
||||||
ret = new MapleGenericPortal(type);
|
ret = new GenericPortal(type);
|
||||||
}
|
}
|
||||||
loadPortal(ret, portal);
|
loadPortal(ret, portal);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadPortal(MapleGenericPortal myPortal, Data portal) {
|
private void loadPortal(GenericPortal myPortal, Data portal) {
|
||||||
myPortal.setName(DataTool.getString(portal.getChildByPath("pn")));
|
myPortal.setName(DataTool.getString(portal.getChildByPath("pn")));
|
||||||
myPortal.setTarget(DataTool.getString(portal.getChildByPath("tn")));
|
myPortal.setTarget(DataTool.getString(portal.getChildByPath("tn")));
|
||||||
myPortal.setTargetMapId(DataTool.getInt(portal.getChildByPath("tm")));
|
myPortal.setTargetMapId(DataTool.getInt(portal.getChildByPath("tm")));
|
||||||
|
|||||||
Reference in New Issue
Block a user