- Joined
- Dec 27, 2009
- Messages
- 254
- Reaction score
- 86
Re: v75 | ShineMS | ShineSource 2.1
Added to library
Added to library
This error has been killing me for days.. Please help i've checked almost all the pages on this topic also..
When I edit noob.properties nothing changes. Like when i edit the number of channels.
Also My friend he can get to the character selection screen but once he double clicks his character it says unable to log onto the game server, when i can login and play perfectly fine. All my java stuff are in the right place and the ip's are set correctly I tried non-hamachi and hamachi with both the same result.
If you help me with my error ill respect u forever![]()
I dont belev dis is stll bein updatd u shud pst in hlp sction so u cna gt moor hlp!
I thought they quit this source....
did they? =S
all i want to know are the commands and npc's and what they do. lol =.=
package net.channel;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.management.InstanceAlreadyExistsException;
import javax.management.MalformedObjectNameException;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import client.MapleCharacter;
import constants.ServerConstants;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Map.Entry;
import net.world.MapleParty;
import tools.DatabaseConnection;
import net.MaplePacket;
import net.MapleServerHandler;
import net.PacketProcessor;
import net.ServerMode;
import net.ServerMode.Mode;
import net.mina.MapleCodecFactory;
import net.world.MaplePartyCharacter;
import net.world.guild.MapleGuild;
import net.world.guild.MapleGuildCharacter;
import net.world.guild.MapleGuildSummary;
import net.world.remote.WorldChannelInterface;
import net.world.remote.WorldRegistry;
import provider.MapleDataProviderFactory;
import scripting.event.EventScriptManager;
import server.ShutdownServer;
import server.TimerManager;
import server.maps.MapleMapFactory;
import tools.MaplePacketCreator;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator;
import org.apache.mina.core.filterchain.IoFilter;
import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.transport.socket.SocketSessionConfig;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import server.MapleSquad;
import server.MapleSquadType;
import server.maps.FakeCharacter;
import server.maps.MapleMap;
public class ChannelServer implements Runnable {
private int port = 7575;
private static WorldRegistry worldRegistry;
private PlayerStorage players = new PlayerStorage();
private int channel;
private String key;
private ChannelWorldInterface cwi;
private WorldChannelInterface wci = null;
private IoAcceptor acceptor;
private String ip;
private boolean shutdown = false;
private boolean finishedShutdown = false;
private MapleMapFactory mapFactory;
private EventScriptManager eventSM;
private static Map<Integer, ChannelServer> instances = new HashMap<Integer, ChannelServer>();
private static Map<String, ChannelServer> pendingInstances = new HashMap<String, ChannelServer>();
private Map<Integer, MapleGuildSummary> gsStore = new HashMap<Integer, MapleGuildSummary>();
private Boolean worldReady = true;
private int instanceId = 0;
private Map<MapleSquadType, MapleSquad> mapleSquads = new HashMap<MapleSquadType, MapleSquad>();
private Collection<FakeCharacter> clones = new LinkedList<FakeCharacter>();
private int PvPis;
private ChannelServer(String key) {
mapFactory = new MapleMapFactory(MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/Map.wz")), MapleDataProviderFactory.getDataProvider(new File(System.getProperty("wzpath") + "/String.wz")));
this.key = key;
}
public static WorldRegistry getWorldRegistry() {
return worldRegistry;
}
public int getInstanceId() {
return instanceId;
}
public void addInstanceId() {
instanceId++;
}
public void reconnectWorld() {
try {
wci.isAvailable();
} catch (RemoteException ex) {
synchronized (worldReady) {
worldReady = false;
}
synchronized (cwi) {
synchronized (worldReady) {
if (worldReady) {
return;
}
}
System.out.println("Reconnecting to world server");
synchronized (wci) {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
Registry registry = LocateRegistry.getRegistry(worldProperties.getProperty("host"), Registry.REGISTRY_PORT, new SslRMIClientSocketFactory());
noobs.close();
worldRegistry = (WorldRegistry) registry.lookup("WorldRegistry");
cwi = new ChannelWorldInterfaceImpl(this);
wci = worldRegistry.registerChannelServer(key, cwi);
Properties dbProp = new Properties();
FileReader fr = new FileReader("db.properties");
dbProp.load(fr);
fr.close();
DatabaseConnection.initialize(dbProp);
DatabaseConnection.getConnection();
wci.serverReady();
} catch (Exception e) {
}
worldReady = true;
}
}
synchronized (worldReady) {
worldReady.notifyAll();
}
}
}
@Override
public void run() {
try {
cwi = new ChannelWorldInterfaceImpl(this);
wci = worldRegistry.registerChannelServer(key, cwi);
eventSM = new EventScriptManager(this, ServerConstants.EVENTS.split(" "));
Properties dbProp = new Properties();
FileReader fileReader = new FileReader("db.properties");
dbProp.load(fileReader);
fileReader.close();
DatabaseConnection.initialize(dbProp);
Connection c = DatabaseConnection.getConnection();
PreparedStatement ps = c.prepareStatement("UPDATE accounts SET loggedin = 0");
ps.executeUpdate();
ps.close();
ps = c.prepareStatement("UPDATE characters SET HasMerchant = 0");
ps.executeUpdate();
ps.close();
port = 7575 + this.channel - 1;
ip = ServerConstants.HOST + ":" + port;
IoBuffer.setUseDirectBuffer(false);
IoBuffer.setAllocator(new SimpleBufferAllocator());
acceptor = new NioSocketAcceptor();
TimerManager tMan = TimerManager.getInstance();
tMan.start();
tMan.register(new respawnMaps(), 10000);
acceptor.setHandler(new MapleServerHandler(PacketProcessor.getProcessor(PacketProcessor.Mode.CHANNELSERVER), channel));
acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 30);
acceptor.getFilterChain().addLast("codec", (IoFilter) new ProtocolCodecFilter(new MapleCodecFactory()));
acceptor.bind(new InetSocketAddress(port));
((SocketSessionConfig) acceptor.getSessionConfig()).setTcpNoDelay(true);
System.out.println("Channel " + getChannel() + ": Listening on port " + port);
wci.serverReady();
eventSM.init();
} catch (Exception e) {
e.printStackTrace();
}
}
public static boolean RBMessage;
public static boolean useAutoRBMessage() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
RBMessage = Boolean.parseBoolean(worldProperties.getProperty("autorbmessage"));
} catch (Exception e) {
//youfail
}
return RBMessage;
}
public static boolean PVPEXP;
public static boolean gainExpInPvP() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
PVPEXP = Boolean.parseBoolean(worldProperties.getProperty("gainexpinpvp"));
} catch (Exception e) {
//youfail
}
return PVPEXP;
}
public static boolean PVPMESO;
public static boolean gainMesoInPvP() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
PVPMESO = Boolean.parseBoolean(worldProperties.getProperty("gainmesoinpvp"));
} catch (Exception e) {
//youfail
}
return PVPMESO;
}
public void shutdown() {
shutdown = true;
boolean error = true;
while (error) {
try {
for (MapleCharacter chr : players.getAllCharacters()) {
synchronized (chr) {
if (chr.getHiredMerchant().isOpen()) {
chr.getHiredMerchant().saveItems();
}
chr.getClient().disconnect();
}
error = false;
}
} catch (Exception e) {
error = true;
}
}
finishedShutdown = true;
wci = null;
cwi = null;
}
public void unbind() {
acceptor.unbind();
}
public static int loadChannelNumberFromProp() {
int channels = 0;
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
channels = Integer.parseInt(worldProperties.getProperty("Channels"));
} catch (Exception e) {
//youfail
}
return channels;
}
public static int loadExpFromProp() {
int exp = 0;
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
exp = Integer.parseInt(worldProperties.getProperty("exp"));
} catch (Exception e) {
//youfail
}
return exp;
}
public static int loadMesoFromProp() {
int mesos = 0;
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
mesos = Integer.parseInt(worldProperties.getProperty("meso"));
} catch (Exception e) {
//youfail
}
return mesos;
}
public static int loadDropFromProp() {
int drops = 0;
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
drops = Integer.parseInt(worldProperties.getProperty("drop"));
} catch (Exception e) {
//youfail
}
return drops;
}
public static String ServerMessage;
public static String loadServerMessageProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
ServerMessage = worldProperties.getProperty("ServerMessage");
} catch (Exception e) {
//youfail
}
return ServerMessage;
}
public static String ServerName;
public static String loadServerNameProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
ServerName = worldProperties.getProperty("servername");
} catch (Exception e) {
//youfail
}
return ServerName;
}
public static String Votelink;
public static String loadVoteLinkFromProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
Votelink = worldProperties.getProperty("votelink");
} catch (Exception e) {
//youfail
}
return Votelink;
}
public static int PVPMap;
public int loadPvPMapFromProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
PVPMap = Integer.parseInt(worldProperties.getProperty("pvpplace"));
} catch (Exception e) {
//youfail
}
return PVPMap;
}
public static String EventMessage;
public static String loadEventMessageProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
EventMessage = worldProperties.getProperty("EventMessage");
} catch (Exception e) {
//youfail
}
return EventMessage;
}
public static String host;
public static String loadHostProp() {
try {
Properties worldProperties = new Properties();
FileReader noobs = new FileReader("world.properties");
worldProperties.load(noobs);
noobs.close();
host = worldProperties.getProperty("host");
} catch (Exception e) {
//youfail
}
return host;
}
public boolean hasFinishedShutdown() {
return finishedShutdown;
}
public MapleMapFactory getMapFactory() {
return mapFactory;
}
private static ChannelServer newInstance(String key) throws InstanceAlreadyExistsException, MalformedObjectNameException {
ChannelServer instance = new ChannelServer(key);
pendingInstances.put(key, instance);
return instance;
}
public static ChannelServer getInstance(int channel) {
return instances.get(channel);
}
public void addPlayer(MapleCharacter chr) {
players.registerPlayer(chr);
chr.getClient().getSession().write(MaplePacketCreator.serverMessage(ServerConstants.SERVER_MESSAGE));
}
public IPlayerStorage getPlayerStorage() {
return players;
}
public void removePlayer(MapleCharacter chr) {
players.deregisterPlayer(chr);
}
public int getConnectedClients() {
return players.getAllCharacters().size();
}
public void setServerMessage(String newMessage) {
ServerConstants.SERVER_MESSAGE = newMessage;
broadcastPacket(MaplePacketCreator.serverMessage(ServerConstants.SERVER_MESSAGE));
}
public void broadcastPacket(MaplePacket data) {
for (MapleCharacter chr : players.getAllCharacters()) {
chr.getClient().getSession().write(data);
}
}
public int getChannel() {
return channel;
}
public void setChannel(int channel) {
if (pendingInstances.containsKey(key)) {
pendingInstances.remove(key);
}
if (instances.containsKey(channel)) {
instances.remove(channel);
}
instances.put(channel, this);
this.channel = channel;
this.mapFactory.setChannel(channel);
}
public static Collection<ChannelServer> getAllInstances() {
return Collections.unmodifiableCollection(instances.values());
}
public String getIP() {
return ip;
}
public String getIP(int channel) {
try {
return getWorldInterface().getIP(channel);
} catch (RemoteException e) {
System.out.println("Lost connection to world server " + e);
throw new RuntimeException("Lost connection to world server");
}
}
public WorldChannelInterface getWorldInterface() {
synchronized (worldReady) {
while (!worldReady) {
try {
worldReady.wait();
} catch (InterruptedException e) {
}
}
}
return wci;
}
public boolean isShutdown() {
return shutdown;
}
public void shutdown(int time) {
TimerManager.getInstance().schedule(new ShutdownServer(getChannel()), time);
}
public EventScriptManager getEventSM() {
return eventSM;
}
public MapleGuild getGuild(MapleGuildCharacter mgc) {
int gid = mgc.getGuildId();
MapleGuild g = null;
try {
g = this.getWorldInterface().getGuild(gid, mgc);
} catch (RemoteException re) {
System.out.println("RemoteException while fetching MapleGuild. " + re);
return null;
}
if (gsStore.get(gid) == null) {
gsStore.put(gid, new MapleGuildSummary(g));
}
return g;
}
public MapleGuildSummary getGuildSummary(int gid) {
if (gsStore.containsKey(gid)) {
return gsStore.get(gid);
} else {
try {
MapleGuild g = this.getWorldInterface().getGuild(gid, null);
if (g != null) {
gsStore.put(gid, new MapleGuildSummary(g));
}
return gsStore.get(gid);
} catch (RemoteException re) {
System.out.println("RemoteException while fetching GuildSummary. " + re);
return null;
}
}
}
public void updateGuildSummary(int gid, MapleGuildSummary mgs) {
gsStore.put(gid, mgs);
}
public void reloadGuildSummary() {
try {
MapleGuild g;
for (int i : gsStore.keySet()) {
g = this.getWorldInterface().getGuild(i, null);
if (g != null) {
gsStore.put(i, new MapleGuildSummary(g));
} else {
gsStore.remove(i);
}
}
} catch (RemoteException re) {
System.out.println("RemoteException while reloading GuildSummary." + re);
}
}
public static void main(String args[]) throws FileNotFoundException, IOException, NotBoundException, InstanceAlreadyExistsException, MalformedObjectNameException {
ServerMode.setServerMode(Mode.CHANNEL);
Registry registry = LocateRegistry.getRegistry("localhost", Registry.REGISTRY_PORT, new SslRMIClientSocketFactory());
worldRegistry = (WorldRegistry) registry.lookup("WorldRegistry");
for (int i = 0; i < ServerConstants.CHANNEL_NUMBER; i++) {
newInstance("release" + (i + 1)).run();
}
DatabaseConnection.getConnection();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
for (ChannelServer channel : getAllInstances()) {
for (MapleCharacter mc : channel.getPlayerStorage().getAllCharacters()) {
mc.saveToDB(true);
if (mc.getHiredMerchant() != null) {
if (mc.getHiredMerchant().isOpen()) {
try {
mc.getHiredMerchant().saveItems();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
}
});
}
public void broadcastGMPacket(MaplePacket data) {
for (MapleCharacter chr : players.getAllCharacters()) {
if (chr.isGM()) {
chr.getClient().getSession().write(data);
}
}
}
public void yellowWorldMessage(String msg) {
for (MapleCharacter mc : getPlayerStorage().getAllCharacters()) {
mc.getClient().getSession().write(MaplePacketCreator.sendYellowTip(msg));
}
}
public void worldMessage(String msg) {
for (MapleCharacter mc : getPlayerStorage().getAllCharacters()) {
mc.dropMessage(msg);
}
}
public List<MapleCharacter> getPartyMembers(MapleParty party) {
List<MapleCharacter> partym = new ArrayList<MapleCharacter>(8);
for (MaplePartyCharacter partychar : party.getMembers()) {
if (partychar.getChannel() == getChannel()) {
MapleCharacter chr = getPlayerStorage().getCharacterByName(partychar.getName());
if (chr != null) {
partym.add(chr);
}
}
}
return partym;
}
public void addClone(FakeCharacter fc) {
clones.add(fc);
}
public void removeClone(FakeCharacter fc) {
clones.remove(fc);
}
public Collection<FakeCharacter> getAllClones() {
return clones;
}
public class respawnMaps implements Runnable {
@Override
public void run() {
for (Entry<Integer, MapleMap> map : mapFactory.getMaps().entrySet()) {
map.getValue().respawn();
}
}
}
public static MapleCharacter getCharacterFromAllServers(int id) {
for (ChannelServer cserv_ : ChannelServer.getAllInstances()) {
MapleCharacter ret = cserv_.getPlayerStorage().getCharacterById(id);
if (ret != null) {
return ret;
}
}
return null;
}
public MapleSquad getMapleSquad(MapleSquadType type) {
return mapleSquads.get(type);
}
public boolean addMapleSquad(MapleSquad squad, MapleSquadType type) {
if (mapleSquads.get(type) == null) {
mapleSquads.remove(type);
mapleSquads.put(type, squad);
return true;
} else {
return false;
}
}
//
// public void weddingMessage(String husband, String wife) {
// for (ChannelServer cserv : ChannelServer.getAllInstances()) {
// for (MapleCharacter mc : cserv.getPlayerStorage().getAllCharacters())
// mc.message(husband+"'s and " + wife + "'s marriage will start in "+ channel +" at the Cathedral.");
// }
// }
public int PvPis() {
if (PvPis > 0 && PvPis < 21 || PvPis >= 100000000 && PvPis <= 990000000) {
return loadPvPMapFromProp();
} else {
return 999999999;
}
}
}
#---------------------------------------------------------------------------#
#------------------------- ShineSource Noob Properties ---------------------#
#---------------------------------------------------------------------------#
# hostname or IP address of your world server
# Default (host = localhost)
host = localhost
# rates
# Default (1337, 1337, 10)
exp = 200
meso = 100
drop = 3
# number of channels you want?
# Default (numberofchannels = 4)
Channels = 5
# Server Scrolling Message
# Default (Welcome to ShineMS Version | Revision 2.0!)
ServerMessage = Developing ****.
# event message when you start up your server
# Default (Love shack - \r\n#rfeel the chocolate rain!)
EventMessage = Love shack - \r\n#rfeel the chocolate rain!
# What's the name of your server?
# Default (ShineSource | ShineMS Revision 2.0 PvP Updated for KOC Skills!)
servername = ShineSource
# Place your voting link here
# Default (http://forum.ragezone.com/f427/release-v75-shinems-shinesource-1-9-a-659213/)
votelink =
# your pvp place? Map or channel. If you're a hater and don't like pvp, just leave it as 999999999
# Default (999999999)
pvpplace = 999999999
# lol i h8
# Do you wish for players to get exp in pvp?
# Default (false)
gainexpinpvp = true
# how about m3sarz?
# Default (false)
gainmesoinpvp = true
I can't hide as a GM...anyone know why?
Also the mobs dont move until you touch them.
And when I use /shutdown or /shutdownnow nothing happens.