mirror of
https://github.com/Zrips/Jobs.git
synced 2024-12-02 07:23:29 +01:00
parent
ea70a33342
commit
8644910fef
@ -479,7 +479,6 @@ public class Jobs extends JavaPlugin {
|
|||||||
getPlayerManager().addPlayerToCache(jPlayer);
|
getPlayerManager().addPlayerToCache(jPlayer);
|
||||||
}
|
}
|
||||||
|
|
||||||
dao.getMap().clear();
|
|
||||||
if (!getPlayerManager().getPlayersCache().isEmpty())
|
if (!getPlayerManager().getPlayersCache().isEmpty())
|
||||||
consoleMsg("&e[Jobs] Preloaded " + getPlayerManager().getPlayersCache().size() + " players data in " +
|
consoleMsg("&e[Jobs] Preloaded " + getPlayerManager().getPlayersCache().size() + " players data in " +
|
||||||
((int) (((System.currentTimeMillis() - time) / 1000d) * 100) / 100D));
|
((int) (((System.currentTimeMillis() - time) / 1000d) * 100) / 100D));
|
||||||
|
@ -5,6 +5,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -801,19 +802,18 @@ public abstract class JobsDAO {
|
|||||||
return map;
|
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() {
|
public void cleanUsers() {
|
||||||
if (!Jobs.getGCManager().DBCleaningUsersUse)
|
if (!Jobs.getGCManager().DBCleaningUsersUse)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JobsConnection conn = getConnection();
|
JobsConnection conn = getConnection();
|
||||||
if (conn == null)
|
if (conn == null)
|
||||||
return;
|
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;
|
PreparedStatement prest = null;
|
||||||
try {
|
try {
|
||||||
prest = conn.prepareStatement("DELETE FROM `" + DBTables.UsersTable.getTableName() + "` WHERE `" + UserTableFields.seen.getCollumn() + "` < ?;");
|
prest = conn.prepareStatement("DELETE FROM `" + DBTables.UsersTable.getTableName() + "` WHERE `" + UserTableFields.seen.getCollumn() + "` < ?;");
|
||||||
@ -829,9 +829,11 @@ public abstract class JobsDAO {
|
|||||||
public void cleanJobs() {
|
public void cleanJobs() {
|
||||||
if (!Jobs.getGCManager().DBCleaningJobsUse)
|
if (!Jobs.getGCManager().DBCleaningJobsUse)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JobsConnection conn = getConnection();
|
JobsConnection conn = getConnection();
|
||||||
if (conn == null)
|
if (conn == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PreparedStatement prest = null;
|
PreparedStatement prest = null;
|
||||||
try {
|
try {
|
||||||
prest = conn.prepareStatement("DELETE FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.level.getCollumn() + "` <= ?;");
|
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() {
|
public String getJobsTableName() {
|
||||||
return DBTables.JobsTable.getTableName();
|
return DBTables.JobsTable.getTableName();
|
||||||
}
|
}
|
||||||
|
@ -1362,7 +1362,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Location loc = event.getLocation();
|
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);
|
? null : loc.getWorld().getNearbyEntities(loc, 4, 4, 4);
|
||||||
if (ents == null) {
|
if (ents == null) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user