mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-04 23:37:49 +01:00
JobsWorld by id more faster
This commit is contained in:
parent
499045c13c
commit
ade5fcc4f1
@ -958,37 +958,37 @@ public class PlayerManager {
|
||||
if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul)
|
||||
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer())));
|
||||
|
||||
double petPay = 0D;
|
||||
Double petPay = null;
|
||||
|
||||
if (ent instanceof Tameable) {
|
||||
Tameable t = (Tameable) ent;
|
||||
if (t.isTamed() && t.getOwner() instanceof Player) {
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (petPay != 0D)
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
}
|
||||
}
|
||||
|
||||
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent)) {
|
||||
if (petPay == 0D)
|
||||
if (petPay == null)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay");
|
||||
if (petPay != 0D)
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
}
|
||||
|
||||
if (victim != null && victim.hasMetadata(getMobSpawnerMetadata())) {
|
||||
double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner");
|
||||
if (amount != 0D)
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner");
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
|
||||
}
|
||||
|
||||
if (getall) {
|
||||
if (petPay == 0D)
|
||||
if (petPay == null)
|
||||
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force);
|
||||
if (petPay != 0D)
|
||||
if (petPay != null)
|
||||
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
|
||||
double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
|
||||
if (amount != 0D)
|
||||
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
|
||||
if (amount != null)
|
||||
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
|
||||
}
|
||||
|
||||
|
@ -1754,7 +1754,7 @@ public abstract class JobsDAO {
|
||||
|
||||
for (String u : uuids) {
|
||||
PreparedStatement ps = conn.prepareStatement("DELETE FROM `" + DBTables.UsersTable.getTableName()
|
||||
+ "` WHERE `" + UserTableFields.player_uuid.getCollumn() + "` = ?;");
|
||||
+ "` WHERE `" + UserTableFields.player_uuid.getCollumn() + "` = ?;");
|
||||
ps.setString(1, u);
|
||||
ps.execute();
|
||||
close(ps);
|
||||
@ -2416,10 +2416,16 @@ public abstract class JobsDAO {
|
||||
|
||||
for (Integer one : missingWorlds) {
|
||||
PreparedStatement prest2 = null;
|
||||
prest2 = conn.prepareStatement("DELETE FROM `" + DBTables.ExploreDataTable.getTableName() + "` WHERE `" + ExploreDataTableFields.worldid.getCollumn() + "` = ?;");
|
||||
prest2.setInt(1, one);
|
||||
prest2.execute();
|
||||
close(prest2);
|
||||
try {
|
||||
prest2 = conn.prepareStatement("DELETE FROM `" + DBTables.ExploreDataTable.getTableName() + "` WHERE `" + ExploreDataTableFields.worldid.getCollumn() + "` = ?;");
|
||||
prest2.setInt(1, one);
|
||||
prest2.execute();
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
close(prest2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
|
@ -34,6 +34,7 @@ public class Util {
|
||||
private static HashMap<UUID, String> questsEditorMap = new HashMap<>();
|
||||
|
||||
private static HashMap<String, JobsWorld> jobsWorlds = new HashMap<>();
|
||||
private static HashMap<Integer, JobsWorld> jobsWorldsId = new HashMap<>();
|
||||
|
||||
public static final List<UUID> LEAVECONFIRM = new ArrayList<>();
|
||||
|
||||
@ -178,11 +179,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static JobsWorld getJobsWorld(int id) {
|
||||
for (JobsWorld one : jobsWorlds.values()) {
|
||||
if (one.getId() == id)
|
||||
return one;
|
||||
}
|
||||
return null;
|
||||
return jobsWorldsId.get(id);
|
||||
}
|
||||
|
||||
public static HashMap<String, JobsWorld> getJobsWorlds() {
|
||||
@ -192,7 +189,8 @@ public class Util {
|
||||
public static void addJobsWorld(JobsWorld jobsWorld) {
|
||||
if (jobsWorld == null || jobsWorld.getId() == 0)
|
||||
return;
|
||||
Util.jobsWorlds.put(jobsWorld.getName().toLowerCase(), jobsWorld);
|
||||
jobsWorlds.put(jobsWorld.getName().toLowerCase(), jobsWorld);
|
||||
jobsWorldsId.put(jobsWorld.getId(), jobsWorld);
|
||||
}
|
||||
|
||||
public static List<String> getFilesFromPackage(String pckgname) throws ClassNotFoundException {
|
||||
|
Loading…
Reference in New Issue
Block a user