Newbie Spellweaver
- Joined
- Jan 3, 2015
- Messages
- 7
- Reaction score
- 0
Hey im trying to run v40b on localhost. When i create a character and click on it, it gives me this error
PlayerLoggedIn java
Code:
IoSession with /127.0.0.1:53520 opened
Jan 03, 2015 1:21:47 PM net.sf.odinms.net.MapleServerHandler messageReceived
SEVERE: Exception during processing packet: net.sf.odinms.net.channel.handler.Pl
ayerLoggedinHandler: Loading char failed (char not found)
java.lang.RuntimeException: Loading char failed (char not found)
at net.sf.odinms.client.MapleCharacter.loadCharFromDB(MapleCharacter.jav
a:206)
at net.sf.odinms.net.channel.handler.PlayerLoggedinHandler.handlePacket(
PlayerLoggedinHandler.java:58)
at net.sf.odinms.net.MapleServerHandler.messageReceived(MapleServerHandl
er.java:147)
at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messa
geReceived(AbstractIoFilterChain.java:570)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
eceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
ractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
ageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flus
h(SimpleProtocolDecoderOutput.java:58)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(Prot
ocolCodecFilter.java:180)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageR
eceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(Abst
ractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.mess
ageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorF
ilter.java:220)
at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.
run(ExecutorFilter.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnabl
e.java:51)
at java.lang.Thread.run(Unknown Source)
PlayerLoggedIn java
Code:
/* 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 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.sf.odinms.net.channel.handler;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.util.Collection;
import net.sf.odinms.client.BuddylistEntry;
import net.sf.odinms.client.CharacterNameAndId;
import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.MapleQuestStatus;
import net.sf.odinms.client.SkillFactory;
import net.sf.odinms.constants.ServerConstants;
import net.sf.odinms.net.AbstractMaplePacketHandler;
import net.sf.odinms.net.channel.ChannelServer;
import net.sf.odinms.net.world.CharacterIdChannelPair;
import net.sf.odinms.net.world.MaplePartyCharacter;
import net.sf.odinms.net.world.PartyOperation;
import net.sf.odinms.net.world.remote.WorldChannelInterface;
import net.sf.odinms.tools.MaplePacketCreator;
import net.sf.odinms.tools.data.input.SeekableLittleEndianAccessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlayerLoggedinHandler extends AbstractMaplePacketHandler {
private static final Logger log = LoggerFactory.getLogger(PlayerLoggedinHandler.class);
[USER=2000004426]Override[/USER]
public boolean validateState(MapleClient c) {
return !c.isLoggedIn();
}
[USER=2000004426]Override[/USER]
public void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
int cid = slea.readInt();
MapleCharacter player = null;
try {
player = MapleCharacter.loadCharFromDB(cid, c, true);
c.setPlayer(player);
} catch (SQLException e) {
log.error("Loading the char failed", e);
}
c.setAccID(player.getAccountID());
int state = c.getLoginState();
boolean allowLogin = true;
ChannelServer channelServer = c.getChannelServer();
synchronized (this) {
try {
WorldChannelInterface worldInterface = channelServer.getWorldInterface();
if (state == MapleClient.LOGIN_SERVER_TRANSITION) {
for (String charName : c.loadCharacterNames(c.getWorld())) {
if (worldInterface.isConnected(charName)) {
log.warn(MapleClient.getLogMessage(player, "Attempting to multiclient the same account with " + charName));
allowLogin = false;
break;
}
}
}
} catch (RemoteException e) {
channelServer.reconnectWorld();
allowLogin = false;
}
if (state != MapleClient.LOGIN_SERVER_TRANSITION || !allowLogin) {
c.setPlayer(null); //REALLY prevent the character from getting deregistered as it is not registered
c.getSession().close();
return;
}
c.updateLoginState(MapleClient.LOGIN_LOGGEDIN);
}
ChannelServer cserv = ChannelServer.getInstance(c.getChannel());
cserv.addPlayer(player);
c.getSession().write(MaplePacketCreator.getCharInfo(player));
player.getMap().addPlayer(player);
c.getSession().write(MaplePacketCreator.serverMessage(ServerConstants.SERVER_MESSAGE));
if (player.isGM()) {
if (player.getGMLevel() > 99) {
player.setMegaHide(true);
}
//SkillFactory.getSkill(9101004).getEffect(1).applyTo(c.getPlayer());
//player.toggleHide(false, !player.isHidden());
}
try {
Collection<BuddylistEntry> buddies = player.getBuddylist().getBuddies();
int buddyIds[] = player.getBuddylist().getBuddyIds();
cserv.getWorldInterface().loggedOn(player.getName(), player.getId(), c.getChannel(), buddyIds);
if (player.getParty() != null) {
channelServer.getWorldInterface().updateParty(player.getParty().getId(), PartyOperation.LOG_ONOFF, new MaplePartyCharacter(player));
}
CharacterIdChannelPair[] onlineBuddies = cserv.getWorldInterface().multiBuddyFind(player.getId(), buddyIds);
for (CharacterIdChannelPair onlineBuddy : onlineBuddies) {
BuddylistEntry ble = player.getBuddylist().get(onlineBuddy.getCharacterId());
ble.setChannel(onlineBuddy.getChannel());
player.getBuddylist().put(ble);
}
c.getSession().write(MaplePacketCreator.updateBuddylist(buddies));
try {
c.getPlayer().showNote();
} catch (SQLException e) {
log.error("LOADING NOTE", e);
}
} catch (RemoteException e) {
log.info("REMOTE THROW", e);
channelServer.reconnectWorld();
}
player.updatePartyMemberHP();
for (MapleQuestStatus status : player.getStartedQuests()) {
if (status.hasMobKills()) {
c.getSession().write(MaplePacketCreator.updateQuestMobKills(status));
}
}
CharacterNameAndId pendingBuddyRequest = player.getBuddylist().pollPendingRequest();
if (pendingBuddyRequest != null) {
player.getBuddylist().put(new BuddylistEntry(pendingBuddyRequest.getName(), pendingBuddyRequest.getId(), -1, false));
c.getSession().write(MaplePacketCreator.requestBuddylistAdd(pendingBuddyRequest.getId(), pendingBuddyRequest.getName()));
}
player.checkMessenger();
player.dropMessage(6, "[Welcome] Welcome to Development!!"); // TODO: yellowTips!!
if (player.getMapId() == 0)
player.dropMessage(5, "Welcome to Development v40 Beta Edition, Player #" + player.getId());
}
}