
Originally Posted by
NemesisToKill
Can you post your MapleMap.addPlayer and MapleMap.removePlayer? I don't think there is a way for that code to have unintended effects unless it was placed weirdly. Also, why would it be 10 seconds? It repeats every 5 seconds.
I changed it to 10 seconds so it wouldn't be too fast and made sure it could work.
PHP Code:
public void addPlayer(final MapleCharacter chr) {
synchronized (characters) {
this.characters.add(chr);
}
if ((cTimestamp + cDuration) > System.currentTimeMillis()) {
chr.announce(MaplePacketCreator.getClock((int) (cDuration / 1000 - ((System.currentTimeMillis() - cTimestamp) / 1000))));
}
synchronized (this.mapobjects) {
if (!chr.isClone()) {
if (onFirstUserEnter.length() != 0 && !chr.hasEntered(onFirstUserEnter, mapid) && MapScriptManager.getInstance().scriptExists(onFirstUserEnter, true)) {
if (getAllPlayer().size() <= 1) {
chr.enteredScript(onFirstUserEnter, mapid);
MapScriptManager.getInstance().getMapScript(chr.getClient(), onFirstUserEnter, true);
}
}
if (onUserEnter.length() != 0) {
if (onUserEnter.equals("cygnusTest") && (mapid < 913040000 || mapid > 913040006)) {
chr.saveLocation("INTRO");
}
MapScriptManager.getInstance().getMapScript(chr.getClient(), onUserEnter, false);
}
if (FieldLimit.CANNOTUSEMOUNTS.check(fieldLimit) && chr.getBuffedValue(MapleBuffStat.MONSTER_RIDING) != null) {
chr.cancelEffectFromBuffStat(MapleBuffStat.MONSTER_RIDING);
chr.cancelBuffStats(MapleBuffStat.MONSTER_RIDING);
}
if (chr.getOccupation() == OccupationConstants.CAMPER&& mapid == 100000000) {
chr.whoreExp = TimerManager.getInstance().register(new Runnable() {
[MENTION=2000004426]Override[/MENTION]
public void run() {
if (chr.getOccupation() == OccupationConstants.CAMPER && mapid == 100000000) {
final int rand = Randomizer.rand(1, 25);
chr.gainOccupationEXP(rand);
}
}
}, 10000);
}
if (mapid == 923010000 && getMonsterById(9300102) == null) {
spawnMonsterOnGroundBelow(MapleLifeFactory.getMonster(9300102), new Point(77, 426));
} else if (mapid == 922241100) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm08/LetsHuntAliens"));
} else if (mapid == 922241100) {
NPCScriptManager.getInstance().start(chr.getClient(), 2050002, null, null);
} else if (mapid == 910000018) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm09/TimeAttack"));
chr.getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, "" + chr.getName() + " has entered the PvP map!"));
} else if (mapid == 910000019) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm09/TimeAttack"));
chr.getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, "" + chr.getName() + " has entered the PvP map!"));
} else if (mapid == 910000020) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm09/TimeAttack"));
chr.getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, "" + chr.getName() + " has entered the PvP map!"));
} else if (mapid == 910000021) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm09/TimeAttack"));
chr.getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, "" + chr.getName() + " has entered the PvP map!"));
} else if (mapid == 910000022) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm09/TimeAttack"));
chr.getMap().broadcastMessage(MaplePacketCreator.serverNotice(5, "" + chr.getName() + " has entered the PvP map!"));
} else if (mapid == 990000300) {
chr.getClient().getSession().write(MaplePacketCreator.musicChange("Bgm06/FinalFight"));
} else if (mapid == 910110000) {
chr.getClient().announce(MaplePacketCreator.getClock(15 * 60));
TimerManager.getInstance().register(new Runnable() {
[MENTION=2000004426]Override[/MENTION]
public void run() {
if (mapid == 910110000) {
chr.getClient().getPlayer().changeMap(chr.getClient().getChannelServer().getMapFactory().getMap(925020000));
}
}
}, 15 * 60 * 1000 + 3000);
}
}
MaplePet[] pets = chr.getPets();
for (int i = 0; i < chr.getPets().length; i++) {
if (pets[i] != null && getGroundBelow(chr.getPosition()) != null) {
pets[i].setPos(getGroundBelow(chr.getPosition()));
chr.announce(MaplePacketCreator.showPet(chr, pets[i], false, false));
} else {
break;
}
}
if (chr.isHidden()) {
broadcastGMMessage(chr, MaplePacketCreator.spawnPlayerMapobject(chr), false);
chr.announce(MaplePacketCreator.getGMEffect(0x10, (byte) 1));
} else {
broadcastMessage(chr, MaplePacketCreator.spawnPlayerMapobject(chr), false);
}
sendObjectPlacement(chr.getClient());
if (isStartingEventMap() && !eventStarted()) {
chr.getMap().getPortal("join00").setPortalStatus(false);
}
if (hasForcedEquip()) {
chr.getClient().announce(MaplePacketCreator.showForcedEquip(-1));
}
if (specialEquip()) {
chr.getClient().announce(MaplePacketCreator.coconutScore(0, 0));
chr.getClient().announce(MaplePacketCreator.showForcedEquip(chr.getTeam()));
}
this.mapobjects.put(chr.getObjectId(), chr);
}
if (chr.getPlayerShop() != null) {
addMapObject(chr.getPlayerShop());
}
MapleStatEffect summonStat = chr.getStatForBuff(MapleBuffStat.SUMMON);
if (!chr.isClone()) {
if (summonStat != null) {
MapleSummon summon = chr.getSummons().get(summonStat.getSourceId());
summon.setPosition(chr.getPosition());
chr.getMap().spawnSummon(summon);
updateMapObjectVisibility(chr, summon);
}
}
if (mapEffect != null) {
mapEffect.sendStartData(chr.getClient());
}
if (mapid == 914000200 || mapid == 914000210 || mapid == 914000220) {
TimerManager.getInstance().schedule(new Runnable() {
[MENTION=2000004426]Override[/MENTION]
public void run() {
chr.getClient().announce(MaplePacketCreator.aranGodlyStats());
}
}, 1500);
}
if (!chr.isClone()) {
if (chr.getEventInstance() != null && chr.getEventInstance().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getEventInstance().getTimeLeft() / 1000)));
}
if (chr.getFitness() != null && chr.getFitness().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getFitness().getTimeLeft() / 1000)));
}
if (chr.getOla() != null && chr.getOla().isTimerStarted()) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (chr.getOla().getTimeLeft() / 1000)));
}
if (mapid == 109060000) {
chr.announce(MaplePacketCreator.rollSnowBall(true, 0, null, null));
}
MonsterCarnival carnival = chr.getCarnival();
MonsterCarnivalParty cparty = chr.getCarnivalParty();
if (carnival != null && cparty != null && (mapid == 980000101 || mapid == 980000201 || mapid == 980000301 || mapid == 980000401 || mapid == 980000501 || mapid == 980000601)) {
chr.getClient().announce(MaplePacketCreator.getClock((int) (carnival.getTimeLeft() / 1000)));
chr.getClient().announce(MaplePacketCreator.startCPQ(chr, carnival.oppositeTeam(cparty)));
}
if (hasClock()) {
Calendar cal = Calendar.getInstance();
chr.getClient().announce((MaplePacketCreator.getClockTime(cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND))));
}
if (hasBoat() == 2) {
chr.getClient().announce((MaplePacketCreator.boatPacket(true)));
} else if (hasBoat() == 1 && (chr.getMapId() != 200090000 || chr.getMapId() != 200090010)) {
chr.getClient().announce(MaplePacketCreator.boatPacket(false));
}
chr.receivePartyMemberHP();
}
for (final WeakReference<MapleCharacter> chrz : chr.getClones()) {
if (chrz.get() != null) {
chrz.get().setPosition(chr.getPosition());
chrz.get().setMap(this);
addPlayer(chrz.get());
}
}
}
PHP Code:
public void removePlayer(MapleCharacter chr) {
synchronized (characters) {
characters.remove(chr);
}
removeMapObject(chr.getObjectId());
if (!chr.isHidden()) {
broadcastMessage(MaplePacketCreator.removePlayerFromMap(chr.getId()));
} else {
broadcastGMMessage(MaplePacketCreator.removePlayerFromMap(chr.getId()));
}
for (MapleMonster monster : chr.getControlledMonsters()) {
monster.setController(null);
monster.setControllerHasAggro(false);
monster.setControllerKnowsAboutAggro(false);
updateMonsterController(monster);
}
if (mapid == 100000000 && chr.whoreExp != null) {
chr.whoreExp.cancel(false);
chr.whoreExp = null;
}
chr.leaveMap();
chr.cancelMapTimeLimitTask();
for (MapleSummon summon : chr.getSummons().values()) {
if (summon.isStationary()) {
chr.cancelBuffStats(MapleBuffStat.PUPPET);
} else {
removeMapObject(summon);
}
}
if (!chr.isClone()) {
for (final WeakReference<MapleCharacter> chrz : chr.getClones()) {
if (chrz.get() != null) {
removePlayer(chrz.get());
}
}
chr.leaveMap();
}
}