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