mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
parent
6be60c1309
commit
2c369c57db
@ -84,11 +84,10 @@ public class Job {
|
||||
|
||||
private Parser moneyEquation, xpEquation, pointsEquation;
|
||||
|
||||
private List<String> fDescription = new ArrayList<>();
|
||||
|
||||
private final List<String> fDescription = new ArrayList<>();
|
||||
private List<String> worldBlacklist = new ArrayList<>();
|
||||
|
||||
private List<Quest> quests = new ArrayList<>();
|
||||
private final List<Quest> quests = new ArrayList<>();
|
||||
private int maxDailyQuests = 1;
|
||||
|
||||
private int id = 0;
|
||||
@ -510,23 +509,23 @@ public class Job {
|
||||
// return getNextQuest(null, null);
|
||||
// }
|
||||
|
||||
Random rand = new Random(System.nanoTime());
|
||||
|
||||
public Quest getNextQuest(List<String> excludeQuests, Integer level) {
|
||||
List<Quest> ls = new ArrayList<>(this.quests);
|
||||
List<Quest> ls = new ArrayList<>(quests);
|
||||
Collections.shuffle(ls);
|
||||
|
||||
int i = 0;
|
||||
while (true) {
|
||||
i++;
|
||||
|
||||
final Random rand = new Random(System.nanoTime());
|
||||
int target = rand.nextInt(100);
|
||||
for (Quest one : ls) {
|
||||
if (one.getChance() <= target && (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase()))) {
|
||||
if (!one.isInLevelRange(level))
|
||||
continue;
|
||||
if (one.getChance() >= target && (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase()))
|
||||
&& one.isInLevelRange(level)) {
|
||||
return one;
|
||||
}
|
||||
}
|
||||
|
||||
if (i > 20)
|
||||
return null;
|
||||
}
|
||||
|
@ -57,10 +57,10 @@ public class Util {
|
||||
if (w != null)
|
||||
return w;
|
||||
|
||||
name = name.replace("_", "").replace(".", "").replace("-", "");
|
||||
name = name.replaceAll("[_|.|-]", "");
|
||||
|
||||
for (World one : Bukkit.getWorlds()) {
|
||||
String n = one.getName().replace("_", "").replace(".", "").replace("-", "");
|
||||
String n = one.getName().replaceAll("[_|.|-]", "");
|
||||
if (n.equalsIgnoreCase(name))
|
||||
return one;
|
||||
}
|
||||
@ -69,7 +69,7 @@ public class Util {
|
||||
}
|
||||
|
||||
public static String firstToUpperCase(String name) {
|
||||
return name.toLowerCase().replace("_", " ").substring(0, 1).toUpperCase() + name.toLowerCase().replace("_", " ").substring(1);
|
||||
return name.toLowerCase().replace('_', ' ').substring(0, 1).toUpperCase() + name.toLowerCase().replace('_', ' ').substring(1);
|
||||
}
|
||||
|
||||
public static HashMap<UUID, String> getJobsEditorMap() {
|
||||
@ -125,7 +125,7 @@ public class Util {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (lookingFor.equals(material)) {
|
||||
if (lookingFor == material) {
|
||||
return block;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user