Hello, I'm trying to put the top pvp to be announced when entering however my code only announces the players that have pvp.
private static void announceTopPvp(Player activeChar)
{
String name = null;
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT char_name, pvpkills FROM characters WHERE accesslevel=0 ORDER BY pvpkills DESC LIMIT 1");
ResultSet rset = statement.executeQuery();
while (rset.next())
{
int pvpKills = rset.getInt("pvpkills");
name = rset.getString("char_name");
if (activeChar.getName().equals(name))
Broadcast.announceToOnlinePlayers(name +" Top PVP Is Now Online with " + pvpKills+ ".");
}
rset.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING,"Erro Top Player Pvp!",e);
}
}
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Weekend Of The Dwarfs Event!
The first event from a set of many, coming soon : 31 Jan - 2 Feb! A weekend dedicated to our hard working friends , dwarfs. During this weekend craft chance is increased by +10% and chance to obtain masterwork items is doubled. Spoil drop rate increased by 10%.
As you may have noticed, normal members cannot edit their own threads.
I have extended normal members to edit their own content up to 1440 minutes (24 hours or 1 day) after they made their topic/post.
To access unlimited edits of your contents, you need to upgrade to Premium or Gold Member .
Question
l2jkain
Hello, I'm trying to put the top pvp to be announced when entering however my code only announces the players that have pvp.
private static void announceTopPvp(Player activeChar)
{
String name = null;
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT char_name, pvpkills FROM characters WHERE accesslevel=0 ORDER BY pvpkills DESC LIMIT 1");
ResultSet rset = statement.executeQuery();
while (rset.next())
{
int pvpKills = rset.getInt("pvpkills");
name = rset.getString("char_name");
if (activeChar.getName().equals(name))
Broadcast.announceToOnlinePlayers(name +" Top PVP Is Now Online with " + pvpKills+ ".");
}
rset.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING,"Erro Top Player Pvp!",e);
}
}
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.