mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
parent
ea70a33342
commit
8644910fef
@ -479,7 +479,6 @@ public class Jobs extends JavaPlugin {
|
||||
getPlayerManager().addPlayerToCache(jPlayer);
|
||||
}
|
||||
|
||||
dao.getMap().clear();
|
||||
if (!getPlayerManager().getPlayersCache().isEmpty())
|
||||
consoleMsg("&e[Jobs] Preloaded " + getPlayerManager().getPlayersCache().size() + " players data in " +
|
||||
((int) (((System.currentTimeMillis() - time) / 1000d) * 100) / 100D));
|
||||
|
@ -5,6 +5,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -801,19 +802,18 @@ public abstract class JobsDAO {
|
||||
return map;
|
||||
}
|
||||
|
||||
private HashMap<Integer, ArrayList<JobsDAOData>> map = new HashMap<>();
|
||||
|
||||
public List<JobsDAOData> getAllJobs(PlayerInfo pInfo) {
|
||||
return map.getOrDefault(pInfo.getID(), new ArrayList<JobsDAOData>());
|
||||
}
|
||||
|
||||
public void cleanUsers() {
|
||||
if (!Jobs.getGCManager().DBCleaningUsersUse)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
long mark = System.currentTimeMillis() - (Jobs.getGCManager().DBCleaningUsersDays * 24 * 60 * 60 * 1000);
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.add(Calendar.DATE, -Jobs.getGCManager().DBCleaningUsersDays);
|
||||
long mark = cal.getTimeInMillis();
|
||||
|
||||
PreparedStatement prest = null;
|
||||
try {
|
||||
prest = conn.prepareStatement("DELETE FROM `" + DBTables.UsersTable.getTableName() + "` WHERE `" + UserTableFields.seen.getCollumn() + "` < ?;");
|
||||
@ -829,9 +829,11 @@ public abstract class JobsDAO {
|
||||
public void cleanJobs() {
|
||||
if (!Jobs.getGCManager().DBCleaningJobsUse)
|
||||
return;
|
||||
|
||||
JobsConnection conn = getConnection();
|
||||
if (conn == null)
|
||||
return;
|
||||
|
||||
PreparedStatement prest = null;
|
||||
try {
|
||||
prest = conn.prepareStatement("DELETE FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.level.getCollumn() + "` <= ?;");
|
||||
@ -2695,10 +2697,6 @@ public abstract class JobsDAO {
|
||||
}
|
||||
}
|
||||
|
||||
public HashMap<Integer, ArrayList<JobsDAOData>> getMap() {
|
||||
return map;
|
||||
}
|
||||
|
||||
public String getJobsTableName() {
|
||||
return DBTables.JobsTable.getTableName();
|
||||
}
|
||||
|
@ -1362,7 +1362,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
Location loc = event.getLocation();
|
||||
Collection<Entity> ents = Version.isCurrentEqualOrLower(Version.v1_8_R1)
|
||||
Collection<Entity> ents = Version.isCurrentEqualOrLower(Version.v1_8_R1) || loc.getWorld() == null
|
||||
? null : loc.getWorld().getNearbyEntities(loc, 4, 4, 4);
|
||||
if (ents == null) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user