How can i make only todaypvps,todaypks,todaydeaths clear to 0? because this code is not working correctly. It's only make in navicat everywhere 0 but! after server restart points are back:(
package com.l2jfrozen.gameserver.model.entity;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Calendar;
import java.sql.SQLException;
import com.l2jfrozen.util.database.L2DatabaseFactory;
import com.l2jfrozen.gameserver.model.entity.Announcements;
import com.l2jfrozen.gameserver.thread.ThreadPoolManager;
import com.l2jfrozen.gameserver.model.L2World;
import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
public class PvpLordTask
{
public static void newPvpLord(){
int masterId = 0;
int topTodayPvps = 0;
Connection con = null;
PreparedStatement state = null;
ResultSet rset = null;
try{
con = L2DatabaseFactory.getInstance().getConnection();
state = con.prepareStatement("SELECT obj_Id,todaypvps FROM characters ORDER BY todaypvps DESC LIMIT 1;");
rset = state.executeQuery();
if(rset.next())
masterId = rset.getInt(1);
if(masterId == 0)
return;
topTodayPvps = rset.getInt("todaypvps");
state.close();
rset.close();
for(L2PcInstance p : L2World.getInstance().getAllPlayers()){
if(p.getObjectId() == masterId)
{
p.sendMessage("You are the PvP Lord!");
p.setPvpLord(true);
p.broadcastUserInfo();
state = con.prepareStatement("UPDATE characters SET pvplord=1 WHERE obj_Id=?");
state.setInt(1, masterId);
state.execute();
state.close();
state = con.prepareStatement("UPDATE characters SET todaypvps=0,todaypks=0,todaydeaths=0 WHERE obj_Id=?");
state.setInt(1, masterId);
state.execute();
state.close();
}
Announcements.getInstance().announceToAll("PvP Lord is : "+p.getName());
Announcements.getInstance().announceToAll("Today PvPs: "+topTodayPvps);
}
}
catch(Exception e){
e.printStackTrace();
}
finally{
try
{
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
}
DISCORD :
utchiha_market
telegram :
https://t.me/utchiha_market
SELLIX STORE :
https://utchihamkt.mysellix.io/
Join our server for more products :
https://discord.gg/hood-services
https://campsite.bio/utchihaamkt
Question
NumL0ck
Hello all! It's a mission help to me:D
How can i make only todaypvps,todaypks,todaydeaths clear to 0? because this code is not working correctly. It's only make in navicat everywhere 0 but! after server restart points are back:(
22 answers to this question
Recommended Posts