mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-06 16:27:59 +01:00
Fixing issue with quest chance value being opposite
This commit is contained in:
parent
497673f2dc
commit
7715864301
@ -18,11 +18,16 @@
|
||||
|
||||
package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.BiPredicate;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -30,8 +35,11 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.BiPredicate;
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIChatColor;
|
||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
|
||||
public class Job {
|
||||
|
||||
@ -502,6 +510,8 @@ 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);
|
||||
Collections.shuffle(ls);
|
||||
@ -509,14 +519,11 @@ public class Job {
|
||||
int i = 0;
|
||||
while (true) {
|
||||
i++;
|
||||
Random rand = new Random(System.nanoTime());
|
||||
int target = rand.nextInt(100);
|
||||
for (Quest one : ls) {
|
||||
if (one.getChance() >= target)
|
||||
if (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase())) {
|
||||
if (one.getChance() <= target && (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase()))) {
|
||||
if (!one.isInLevelRange(level))
|
||||
continue;
|
||||
|
||||
return one;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user