Rename and clean up MapleGenericPortal

This commit is contained in:
P0nk
2021-09-09 22:21:12 +02:00
parent 0ddf49c7b6
commit 897f2a857f
3 changed files with 12 additions and 13 deletions

View File

@@ -32,20 +32,19 @@ import tools.PacketCreator;
import java.awt.*;
public class MapleGenericPortal implements MaplePortal {
public class GenericPortal implements MaplePortal {
private String name;
private String target;
private Point position;
private int targetmap;
private int type;
private final int type;
private boolean status = true;
private int id;
private String scriptName;
private boolean portalState;
private MonitoredReentrantLock scriptLock = null;
public MapleGenericPortal(int type) {
public GenericPortal(int type) {
this.type = type;
}
@@ -117,9 +116,9 @@ public class MapleGenericPortal implements MaplePortal {
@Override
public void setScriptName(String scriptName) {
this.scriptName = scriptName;
if(scriptName != null) {
if(scriptLock == null) {
if (scriptName != null) {
if (scriptLock == null) {
scriptLock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.PORTAL, true);
}
} else {
@@ -138,7 +137,7 @@ public class MapleGenericPortal implements MaplePortal {
} finally {
scriptLock.unlock();
}
} catch(NullPointerException npe) {
} catch (NullPointerException npe) {
npe.printStackTrace();
}
} else if (getTargetMapId() != 999999999) {

View File

@@ -21,7 +21,7 @@
*/
package server.maps;
public class MapleMapPortal extends MapleGenericPortal {
public class MapleMapPortal extends GenericPortal {
public MapleMapPortal() {
super(MaplePortal.MAP_PORTAL);
}

View File

@@ -34,17 +34,17 @@ public class MaplePortalFactory {
}
public MaplePortal makePortal(int type, Data portal) {
MapleGenericPortal ret = null;
GenericPortal ret = null;
if (type == MaplePortal.MAP_PORTAL) {
ret = new MapleMapPortal();
} else {
ret = new MapleGenericPortal(type);
ret = new GenericPortal(type);
}
loadPortal(ret, portal);
return ret;
}
private void loadPortal(MapleGenericPortal myPortal, Data portal) {
private void loadPortal(GenericPortal myPortal, Data portal) {
myPortal.setName(DataTool.getString(portal.getChildByPath("pn")));
myPortal.setTarget(DataTool.getString(portal.getChildByPath("tn")));
myPortal.setTargetMapId(DataTool.getInt(portal.getChildByPath("tm")));