-
[Release] No more MySQL editing for login
I made a shutdown hook for logging all accounts out. Takes away having to edit your database if you forced your batches shut.
Code:
public class MapleLogoutHook extends java.lang.Thread {
public void run() {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET loggedin = 0");
ps.executeUpdate();
ps.close();
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
-
Re: [Release] No more MySQL editing for login
lol might aswell shove it inside the shutdown hook
-
Re: [Release] No more MySQL editing for login
-
Re: [Release] No more MySQL editing for login
I was going to make something similar to this a long time ago, but never got around to it.
-
Re: [Release] No more MySQL editing for login
lol traitor your so damn lazy xD
but this is awsome
its so anoying to have to reset evreyone to 0
-
Re: [Release] No more MySQL editing for login
-
Re: [Release] No more MySQL editing for login
Very nice, saves the trouble to go MySQL
-
Re: [Release] No more MySQL editing for login
you're on fire man ;D
thanks :D
-
Re: [Release] No more MySQL editing for login
Simple and easy. you can just run the query anyway <_<.
-
Re: [Release] No more MySQL editing for login
sinems has it so everytime you open your server, it does that.
-
Re: [Release] No more MySQL editing for login
thanks for the replies ;)
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
josho192837
Jvlaple, you'll have to give some info for these guys. They're not smart enough to actually add stuff, hence all the repacks -_-
Ummm Leech Protection FTW?
Anyways Nice release, I think I had tried to do this, back when I didn't know SQL and I failed, anyways Nice Release Again.
Code:
catch (Exception ex) {
throw new RuntimeException(ex);
}
Forgive me if I'm mistaken but shouldn't it be throw then catch?
By the way, you're missing a closing brace at the end.
-
Re: [Release] No more MySQL editing for login
wait, where do i put this stuff,
sorry idk :P:
-
Re: [Release] No more MySQL editing for login
You don't need to do this. You can update it inside ChannelServer.java inside the run() function.
-
Re: [Release] No more MySQL editing for login
You could just remove the entire loggedin thing and get on with it..
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
RMZero213
You could just remove the entire loggedin thing and get on with it..
OdinMS already sets loggedin to 0 on server start, so this was never needed anyway; and loggedin probably has some sort of use.
-
Re: [Release] No more MySQL editing for login
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
MiniAxel
OdinMS already sets loggedin to 0 on server start, so this was never needed anyway; and loggedin probably has some sort of use.
No it doesn't. Only some repacks do.
And that comment was in reply to the release. If you make a hook for resetting to 0 then you obviously have no use for it and thus it's better to just remove loggedin itself..
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
RMZero213
No it doesn't. Only some repacks do.
Code:
@Override
public void run() {
try {
cwi = new ChannelWorldInterfaceImpl(this);
wci = worldRegistry.registerChannelServer(key, cwi);
props = wci.getGameProperties();
expRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.exp"));
mesoRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.meso"));
dropRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.drop"));
bossdropRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.bossdrop"));
petExpRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.petExp"));
serverMessage = props.getProperty("net.sf.odinms.world.serverMessage");
dropUndroppables = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.alldrop", "false"));
moreThanOne = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.morethanone", "false"));
eventSM = new EventScriptManager(this, props.getProperty("net.sf.odinms.channel.events").split(","));
gmWhiteText = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.gmWhiteText", "false"));
cashshop = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.cashshop", "false"));
Properties dbProp = new Properties();
FileReader fileReader = new FileReader("db.properties");
dbProp.load(fileReader);
fileReader.close();
DatabaseConnection.setProps(dbProp);
DatabaseConnection.getConnection();
Connection c = DatabaseConnection.getConnection();
PreparedStatement ps;
try {
ps = c.prepareStatement("UPDATE accounts SET loggedin = 0");
ps.executeUpdate();
ps.close();
} catch (SQLException ex) {
log.error("Could not reset databases",ex);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
From Valhalla, and old version too.
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
MiniAxel
Code:
@Override
public void run() {
try {
cwi = new ChannelWorldInterfaceImpl(this);
wci = worldRegistry.registerChannelServer(key, cwi);
props = wci.getGameProperties();
expRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.exp"));
mesoRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.meso"));
dropRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.drop"));
bossdropRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.bossdrop"));
petExpRate = Integer.parseInt(props.getProperty("net.sf.odinms.world.petExp"));
serverMessage = props.getProperty("net.sf.odinms.world.serverMessage");
dropUndroppables = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.alldrop", "false"));
moreThanOne = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.morethanone", "false"));
eventSM = new EventScriptManager(this, props.getProperty("net.sf.odinms.channel.events").split(","));
gmWhiteText = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.gmWhiteText", "false"));
cashshop = Boolean.parseBoolean(props.getProperty("net.sf.odinms.world.cashshop", "false"));
Properties dbProp = new Properties();
FileReader fileReader = new FileReader("db.properties");
dbProp.load(fileReader);
fileReader.close();
DatabaseConnection.setProps(dbProp);
DatabaseConnection.getConnection();
Connection c = DatabaseConnection.getConnection();
PreparedStatement ps;
try {
ps = c.prepareStatement("UPDATE accounts SET loggedin = 0");
ps.executeUpdate();
ps.close();
} catch (SQLException ex) {
log.error("Could not reset databases",ex);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
From Valhalla, and old version too.
You said OdinMS, not Valhalla.
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
RMZero213
You said OdinMS, not Valhalla.
Fair enough, I think it was added in OdinTeh so most servers should have it..?
-
Re: [Release] No more MySQL editing for login
I already had this, but terrific release ;)
-
Re: [Release] No more MySQL editing for login
Quote:
Originally Posted by
zzlawlzz
Ya where do u put this???
Quote:
Originally Posted by
GMLooney
Ummm Leech Protection FTW?
^^^
-
Re: [Release] No more MySQL editing for login
This is in SineMS as well, except in LoginServer.java
-
Re: [Release] No more MySQL editing for login
Great, for lazy dumbs .... run the query :):
Code:
update accounts set loggedin = 0