mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-04 23:37:49 +01:00
parent
9fdbc0588d
commit
9a6d657c61
@ -599,7 +599,7 @@ public class ConfigManager {
|
||||
|
||||
int amount = 10;
|
||||
try {
|
||||
amount = Integer.valueOf(myKey);
|
||||
amount = Integer.valueOf(myKey);
|
||||
} catch (NumberFormatException e) {
|
||||
Jobs.getPluginLogger().warning("Job " + jobName + " has an invalid " + actionType.getName() + " type property: " + myKey + "!");
|
||||
return null;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
@ -14,10 +15,12 @@ public class CurrencyLimit {
|
||||
|
||||
public CurrencyLimit(boolean enabled, List<CurrencyType> stopWith, int timeLimit, int announcementDelay, Parser maxEquation) {
|
||||
this.enabled = enabled;
|
||||
this.stopWith = stopWith;
|
||||
this.stopWith = stopWith == null ? new ArrayList<>() : stopWith;
|
||||
this.timeLimit = timeLimit;
|
||||
this.announcementDelay = announcementDelay;
|
||||
this.maxEquation = maxEquation;
|
||||
|
||||
if (maxEquation != null)
|
||||
this.maxEquation = maxEquation;
|
||||
}
|
||||
|
||||
public CurrencyLimit() {
|
||||
@ -36,7 +39,7 @@ public class CurrencyLimit {
|
||||
}
|
||||
|
||||
public void setStopWith(List<CurrencyType> stopWith) {
|
||||
this.stopWith = stopWith;
|
||||
this.stopWith = stopWith == null ? new ArrayList<>() : stopWith;
|
||||
}
|
||||
|
||||
public int getTimeLimit() {
|
||||
@ -60,7 +63,8 @@ public class CurrencyLimit {
|
||||
}
|
||||
|
||||
public void setMaxEquation(Parser maxEquation) {
|
||||
this.maxEquation = maxEquation;
|
||||
if (maxEquation != null)
|
||||
this.maxEquation = maxEquation;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ import org.bukkit.inventory.ItemStack;
|
||||
import java.util.*;
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
import javax.swing.Box.Filler;
|
||||
|
||||
public class Job {
|
||||
|
||||
private EnumMap<ActionType, List<JobInfo>> jobInfo = new EnumMap<>(ActionType.class);
|
||||
@ -150,6 +152,10 @@ public class Job {
|
||||
|
||||
public void updateTotalPlayers() {
|
||||
totalPlayers = Jobs.getJobsDAO().getTotalPlayerAmountByJobName(jobName);
|
||||
if (totalPlayers <= 0) {
|
||||
totalPlayers = Jobs.getJobsDAO().getTotalPlayerAmountByJobName(fullName);
|
||||
}
|
||||
|
||||
updateBonus();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class JobsPlayer {
|
||||
public ArrayList<JobProgression> progression = new ArrayList<>();
|
||||
private ArchivedJobs archivedJobs = new ArchivedJobs();
|
||||
|
||||
private PaymentData paymentLimits = null;
|
||||
private PaymentData paymentLimits;
|
||||
|
||||
private HashMap<String, ArrayList<BoostCounter>> boostCounter = new HashMap<>();
|
||||
|
||||
@ -74,7 +74,7 @@ public class JobsPlayer {
|
||||
|
||||
private Long seen = System.currentTimeMillis();
|
||||
|
||||
private HashMap<String, Boolean> permissionsCache = null;
|
||||
private HashMap<String, Boolean> permissionsCache;
|
||||
private Long lastPermissionUpdate = -1L;
|
||||
|
||||
private HashMap<String, HashMap<String, QuestProgression>> qProgression = new HashMap<>();
|
||||
@ -83,7 +83,7 @@ public class JobsPlayer {
|
||||
|
||||
private final HashMap<UUID, HashMap<Job, Long>> leftTimes = new HashMap<>();
|
||||
|
||||
private PlayerPoints pointsData = null;
|
||||
private PlayerPoints pointsData;
|
||||
|
||||
public JobsPlayer(String userName) {
|
||||
this.userName = userName == null ? "Unknown" : userName;
|
||||
@ -234,10 +234,7 @@ public class JobsPlayer {
|
||||
* @return the player
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
if (playerUUID != null)
|
||||
return Bukkit.getPlayer(playerUUID);
|
||||
|
||||
return null;
|
||||
return playerUUID != null ? Bukkit.getPlayer(playerUUID) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -890,16 +887,12 @@ public class JobsPlayer {
|
||||
return ls;
|
||||
|
||||
HashMap<String, QuestProgression> qpl = qProgression.get(job.getName());
|
||||
|
||||
if (qpl == null)
|
||||
return ls;
|
||||
|
||||
for (Entry<String, QuestProgression> one : qpl.entrySet()) {
|
||||
QuestProgression prog = one.getValue();
|
||||
if (prog.isEnded())
|
||||
continue;
|
||||
|
||||
if (prog.getQuest() == null)
|
||||
if (prog.isEnded() || prog.getQuest() == null)
|
||||
continue;
|
||||
|
||||
for (Entry<ActionType, HashMap<String, QuestObjective>> oneAction : prog.getQuest().getObjectives().entrySet()) {
|
||||
@ -948,7 +941,6 @@ public class JobsPlayer {
|
||||
HashMap<String, QuestProgression> orprog = qProgression.get(quest.getJob().getName());
|
||||
|
||||
Quest q = quest.getJob().getNextQuest(getQuestNameList(quest.getJob(), null), getJobProgression(quest.getJob()).getLevel());
|
||||
|
||||
if (q == null) {
|
||||
for (JobProgression one : this.getJobProgression()) {
|
||||
if (one.getJob().isSame(quest.getJob()))
|
||||
@ -1211,8 +1203,7 @@ public class JobsPlayer {
|
||||
if (maxV == null || maxV == 0)
|
||||
maxV = (double) Jobs.getGCManager().getBrewingStandsMaxDefault();
|
||||
|
||||
int max = maxV.intValue();
|
||||
return max;
|
||||
return maxV.intValue();
|
||||
}
|
||||
|
||||
public int getMaxFurnacesAllowed() {
|
||||
@ -1221,9 +1212,7 @@ public class JobsPlayer {
|
||||
if (maxV == null || maxV == 0)
|
||||
maxV = (double) Jobs.getGCManager().getFurnacesMaxDefault();
|
||||
|
||||
int max = maxV.intValue();
|
||||
|
||||
return max;
|
||||
return maxV.intValue();
|
||||
}
|
||||
|
||||
public int getSkippedQuests() {
|
||||
@ -1244,10 +1233,7 @@ public class JobsPlayer {
|
||||
return false;
|
||||
|
||||
HashMap<Job, Long> map = leftTimes.get(uuid);
|
||||
if (!map.containsKey(job))
|
||||
return false;
|
||||
|
||||
return map.get(job).longValue() < System.currentTimeMillis();
|
||||
return map.containsKey(job) && map.get(job).longValue() < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void setLeftTime(Job job) {
|
||||
|
@ -1192,7 +1192,7 @@ public abstract class JobsDAO {
|
||||
ResultSet res = null;
|
||||
try {
|
||||
Job job = Jobs.getJob(JobName);
|
||||
if (job != null) {
|
||||
if (job != null && job.getId() != 0) {
|
||||
prest = conn.prepareStatement("SELECT COUNT(*) FROM `" + getJobsTableName() + "` WHERE `" + JobsTableFields.jobid + "` = ?;");
|
||||
prest.setInt(1, job.getId());
|
||||
res = prest.executeQuery();
|
||||
|
Loading…
Reference in New Issue
Block a user