mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
Some fixes
- Fixed when crafting tipped arrows, it didn't work - Fix when PayForEachCraft option not works - Some null checks to prevent exceptions - Trying to fix issue with editpoints
This commit is contained in:
parent
4d0e4be8dd
commit
1e4b7aa002
@ -205,7 +205,6 @@ public class PlayerManager {
|
|||||||
jPlayer.onConnect();
|
jPlayer.onConnect();
|
||||||
jPlayer.reloadHonorific();
|
jPlayer.reloadHonorific();
|
||||||
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
Jobs.getPermissionHandler().recalculatePermissions(jPlayer);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,10 +775,11 @@ public class PlayerManager {
|
|||||||
*/
|
*/
|
||||||
public void performCommandOnLevelUp(JobsPlayer jPlayer, Job job, int oldLevel) {
|
public void performCommandOnLevelUp(JobsPlayer jPlayer, Job job, int oldLevel) {
|
||||||
int newLevel = oldLevel + 1;
|
int newLevel = oldLevel + 1;
|
||||||
Player player = Bukkit.getServer().getPlayer(jPlayer.getUniqueId());
|
Player player = Bukkit.getPlayer(jPlayer.getUniqueId());
|
||||||
JobProgression prog = jPlayer.getJobProgression(job);
|
JobProgression prog = jPlayer.getJobProgression(job);
|
||||||
if (prog == null)
|
if (prog == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (JobCommands command : job.getCommands()) {
|
for (JobCommands command : job.getCommands()) {
|
||||||
if (newLevel >= command.getLevelFrom() && newLevel <= command.getLevelUntil()) {
|
if (newLevel >= command.getLevelFrom() && newLevel <= command.getLevelUntil()) {
|
||||||
for (String commandString : new ArrayList<String>(command.getCommands())) {
|
for (String commandString : new ArrayList<String>(command.getCommands())) {
|
||||||
@ -860,7 +860,7 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<UUID, HashMap<Job, ItemBonusCache>> cache = new HashMap<>();
|
private final HashMap<UUID, HashMap<Job, ItemBonusCache>> cache = new HashMap<>();
|
||||||
|
|
||||||
public void resetiItemBonusCache(UUID uuid) {
|
public void resetiItemBonusCache(UUID uuid) {
|
||||||
cache.remove(uuid);
|
cache.remove(uuid);
|
||||||
@ -875,20 +875,20 @@ public class PlayerManager {
|
|||||||
|
|
||||||
ItemBonusCache c = cj.get(prog);
|
ItemBonusCache c = cj.get(prog);
|
||||||
if (c == null) {
|
if (c == null) {
|
||||||
c = new ItemBonusCache(player, prog);
|
c = new ItemBonusCache();
|
||||||
c.recheck();
|
c.setBoostMultiplier(getInventoryBoost(player, prog));
|
||||||
cj.put(prog, c);
|
cj.put(prog, c);
|
||||||
return c.getBoostMultiplier();
|
return c.getBoostMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.getBoostMultiplier();
|
return c.getBoostMultiplier();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoostMultiplier getInventoryBoost(Player player, Job prog) {
|
public BoostMultiplier getInventoryBoost(Player player, Job prog) {
|
||||||
BoostMultiplier data = new BoostMultiplier();
|
BoostMultiplier data = new BoostMultiplier();
|
||||||
if (player == null)
|
if (player == null || prog == null)
|
||||||
return data;
|
|
||||||
if (prog == null)
|
|
||||||
return data;
|
return data;
|
||||||
|
|
||||||
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
ItemStack iih = Jobs.getNms().getItemInMainHand(player);
|
||||||
JobItems jitem = getJobsItemByNbt(iih);
|
JobItems jitem = getJobsItemByNbt(iih);
|
||||||
if (jitem != null && jitem.getJobs().contains(prog))
|
if (jitem != null && jitem.getJobs().contains(prog))
|
||||||
@ -919,9 +919,7 @@ public class PlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean containsItemBoostByNBT(ItemStack item) {
|
public boolean containsItemBoostByNBT(ItemStack item) {
|
||||||
if (item == null)
|
return item == null ? false : Jobs.getReflections().hasNbtString(item, JobsItemBoost);
|
||||||
return false;
|
|
||||||
return Jobs.getReflections().hasNbtString(item, JobsItemBoost);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String JobsItemBoost = "JobsItemBoost";
|
private final String JobsItemBoost = "JobsItemBoost";
|
||||||
|
@ -5,10 +5,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public class SignInfo {
|
public class SignInfo {
|
||||||
|
|
||||||
private List<jobsSign> AllSigns = new ArrayList<>();
|
private final List<jobsSign> AllSigns = new ArrayList<>();
|
||||||
|
|
||||||
public void setAllSigns(List<jobsSign> AllSigns) {
|
public void setAllSigns(List<jobsSign> AllSigns) {
|
||||||
this.AllSigns = AllSigns;
|
this.AllSigns.clear();
|
||||||
|
this.AllSigns.addAll(AllSigns == null ? new ArrayList<>() : AllSigns);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<jobsSign> GetAllSigns() {
|
public List<jobsSign> GetAllSigns() {
|
||||||
|
@ -11,9 +11,7 @@ public class jobsSign {
|
|||||||
|
|
||||||
private String worldName;
|
private String worldName;
|
||||||
|
|
||||||
private Integer x;
|
private Integer x, y, z;
|
||||||
private Integer y;
|
|
||||||
private Integer z;
|
|
||||||
private World world;
|
private World world;
|
||||||
private Location loc;
|
private Location loc;
|
||||||
|
|
||||||
@ -105,9 +103,7 @@ public class jobsSign {
|
|||||||
|
|
||||||
String[] split = string.replace(",", ".").split(";");
|
String[] split = string.replace(",", ".").split(";");
|
||||||
|
|
||||||
Integer x = 0;
|
int x = 0, y = 0, z = 0;
|
||||||
Integer y = 0;
|
|
||||||
Integer z = 0;
|
|
||||||
|
|
||||||
if (split.length > 0)
|
if (split.length > 0)
|
||||||
try {
|
try {
|
||||||
|
@ -32,11 +32,6 @@ public class editpoints implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlayerPoints pointInfo = jPlayer.getPointsData();
|
PlayerPoints pointInfo = jPlayer.getPointsData();
|
||||||
if (pointInfo == null) {
|
|
||||||
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", jPlayer.getName()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (args[0].toLowerCase()) {
|
switch (args[0].toLowerCase()) {
|
||||||
case "take":
|
case "take":
|
||||||
pointInfo.takePoints(amount);
|
pointInfo.takePoints(amount);
|
||||||
@ -63,6 +58,7 @@ public class editpoints implements Cmd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Jobs.getJobsDAO().savePoints(jPlayer);
|
Jobs.getJobsDAO().savePoints(jPlayer);
|
||||||
|
Jobs.getJobsDAO().loadPoints(jPlayer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ public class ShopManager {
|
|||||||
if (NameSection.isBoolean("Icon.HideWithoutPermission"))
|
if (NameSection.isBoolean("Icon.HideWithoutPermission"))
|
||||||
Sitem.setHideWithoutPerm(NameSection.getBoolean("Icon.HideWithoutPermission"));
|
Sitem.setHideWithoutPerm(NameSection.getBoolean("Icon.HideWithoutPermission"));
|
||||||
|
|
||||||
if (NameSection.isList("RequiredPermission") && !NameSection.getStringList("RequiredPermission").isEmpty()) {
|
if (NameSection.isList("RequiredPermission")) {
|
||||||
Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission"));
|
Sitem.setRequiredPerm(NameSection.getStringList("RequiredPermission"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,43 +1,14 @@
|
|||||||
package com.gamingmesh.jobs.container;
|
package com.gamingmesh.jobs.container;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
|
||||||
|
|
||||||
public class ItemBonusCache {
|
public class ItemBonusCache {
|
||||||
|
|
||||||
private Player player;
|
|
||||||
private Long lastCheck = null;
|
|
||||||
private BoostMultiplier bm = new BoostMultiplier();
|
private BoostMultiplier bm = new BoostMultiplier();
|
||||||
private Job job;
|
|
||||||
|
|
||||||
public ItemBonusCache(Player player, Job job) {
|
|
||||||
this.player = player;
|
|
||||||
this.job = job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getLastCheck() {
|
|
||||||
return lastCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastCheck(Long lastCheck) {
|
|
||||||
this.lastCheck = lastCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BoostMultiplier getBoostMultiplier() {
|
public BoostMultiplier getBoostMultiplier() {
|
||||||
if (lastCheck == null || System.currentTimeMillis() - lastCheck > 1000 * 60)
|
|
||||||
recheck();
|
|
||||||
return bm;
|
return bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBoostMultiplier(BoostMultiplier bm) {
|
public void setBoostMultiplier(BoostMultiplier bm) {
|
||||||
this.bm = bm;
|
this.bm = bm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBonusCache recheck() {
|
|
||||||
bm = Jobs.getPlayerManager().getInventoryBoost(player, job);
|
|
||||||
lastCheck = System.currentTimeMillis();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.gamingmesh.jobs.container;
|
|||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
import com.gamingmesh.jobs.Jobs;
|
||||||
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||||
|
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
|
||||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||||
import com.gamingmesh.jobs.stuff.ChatColor;
|
import com.gamingmesh.jobs.stuff.ChatColor;
|
||||||
|
|
||||||
@ -145,9 +146,7 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSame(Job job) {
|
public boolean isSame(Job job) {
|
||||||
if (job == null)
|
return job == null ? false : getName().equalsIgnoreCase(job.getName());
|
||||||
return false;
|
|
||||||
return this.getName().equalsIgnoreCase(job.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTotalPlayers() {
|
public int getTotalPlayers() {
|
||||||
@ -166,22 +165,26 @@ public class Job {
|
|||||||
public void updateBonus() {
|
public void updateBonus() {
|
||||||
if (!Jobs.getGCManager().useDynamicPayment)
|
if (!Jobs.getGCManager().useDynamicPayment)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Parser eq = Jobs.getGCManager().DynamicPaymentEquation;
|
Parser eq = Jobs.getGCManager().DynamicPaymentEquation;
|
||||||
eq.setVariable("totalworkers", Jobs.getJobsDAO().getTotalPlayers());
|
eq.setVariable("totalworkers", Jobs.getJobsDAO().getTotalPlayers());
|
||||||
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
eq.setVariable("totaljobs", Jobs.getJobs().size());
|
||||||
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
eq.setVariable("jobstotalplayers", getTotalPlayers());
|
||||||
|
|
||||||
double now = eq.getValue();
|
double now = eq.getValue();
|
||||||
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
if (now > Jobs.getGCManager().DynamicPaymentMaxBonus)
|
||||||
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
now = Jobs.getGCManager().DynamicPaymentMaxBonus;
|
||||||
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty * -1)
|
if (now < Jobs.getGCManager().DynamicPaymentMaxPenalty * -1)
|
||||||
now = Jobs.getGCManager().DynamicPaymentMaxPenalty * -1;
|
now = Jobs.getGCManager().DynamicPaymentMaxPenalty * -1;
|
||||||
|
|
||||||
this.bonus = (now / 100D);
|
this.bonus = (now / 100D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getBonus() {
|
public double getBonus() {
|
||||||
if (this.bonus == null)
|
if (bonus == null)
|
||||||
updateBonus();
|
updateBonus();
|
||||||
return this.bonus == null ? 0D : this.bonus;
|
|
||||||
|
return bonus == null ? 0D : bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCmdOnJoin() {
|
public List<String> getCmdOnJoin() {
|
||||||
@ -226,6 +229,11 @@ public class Job {
|
|||||||
|
|
||||||
public JobInfo getJobInfo(ActionInfo action, int level) {
|
public JobInfo getJobInfo(ActionInfo action, int level) {
|
||||||
BiPredicate<JobInfo, ActionInfo> condition = (jobInfo, actionInfo) -> {
|
BiPredicate<JobInfo, ActionInfo> condition = (jobInfo, actionInfo) -> {
|
||||||
|
if (actionInfo instanceof PotionItemActionInfo) {
|
||||||
|
return jobInfo.getName().equalsIgnoreCase(((PotionItemActionInfo) action).getNameWithSub()) ||
|
||||||
|
(jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(((PotionItemActionInfo) action).getNameWithSub());
|
||||||
|
}
|
||||||
|
|
||||||
return jobInfo.getName().equalsIgnoreCase(action.getNameWithSub()) ||
|
return jobInfo.getName().equalsIgnoreCase(action.getNameWithSub()) ||
|
||||||
(jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(action.getNameWithSub()) ||
|
(jobInfo.getName() + ":" + jobInfo.getMeta()).equalsIgnoreCase(action.getNameWithSub()) ||
|
||||||
jobInfo.getName().equalsIgnoreCase(action.getName());
|
jobInfo.getName().equalsIgnoreCase(action.getName());
|
||||||
@ -327,19 +335,19 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxLevel(JobsPlayer player) {
|
public int getMaxLevel(JobsPlayer player) {
|
||||||
if (player == null)
|
return player == null ? getMaxLevel() : player.getMaxJobLevelAllowed(this);
|
||||||
return getMaxLevel();
|
|
||||||
return player.getMaxJobLevelAllowed(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxLevel(CommandSender sender) {
|
public int getMaxLevel(CommandSender sender) {
|
||||||
if (sender == null)
|
if (sender == null)
|
||||||
return getMaxLevel();
|
return getMaxLevel();
|
||||||
|
|
||||||
if (sender instanceof Player) {
|
if (sender instanceof Player) {
|
||||||
JobsPlayer player = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
JobsPlayer player = Jobs.getPlayerManager().getJobsPlayer((Player) sender);
|
||||||
if (player != null)
|
if (player != null)
|
||||||
return player.getMaxJobLevelAllowed(this);
|
return player.getMaxJobLevelAllowed(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getMaxLevel() > getVipMaxLevel() ? getMaxLevel() : getVipMaxLevel();
|
return getMaxLevel() > getVipMaxLevel() ? getMaxLevel() : getVipMaxLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +466,8 @@ public class Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setFullDescription(List<String> fDescription) {
|
public void setFullDescription(List<String> fDescription) {
|
||||||
this.fDescription = fDescription;
|
this.fDescription.clear();
|
||||||
|
this.fDescription.addAll(fDescription == null ? new ArrayList<>() : fDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Quest> getQuests() {
|
public List<Quest> getQuests() {
|
||||||
@ -480,7 +489,7 @@ public class Job {
|
|||||||
|
|
||||||
public void setQuests(List<Quest> quests) {
|
public void setQuests(List<Quest> quests) {
|
||||||
this.quests.clear();
|
this.quests.clear();
|
||||||
this.quests = quests;
|
this.quests.addAll(quests == null ? new ArrayList<>() : quests);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Quest getNextQuest() {
|
// public Quest getNextQuest() {
|
||||||
@ -499,7 +508,6 @@ public class Job {
|
|||||||
for (Quest one : ls) {
|
for (Quest one : ls) {
|
||||||
if (one.getChance() >= target)
|
if (one.getChance() >= target)
|
||||||
if (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase())) {
|
if (excludeQuests == null || !excludeQuests.contains(one.getConfigName().toLowerCase())) {
|
||||||
|
|
||||||
if (!one.isInLevelRange(level))
|
if (!one.isInLevelRange(level))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class JobItems {
|
|||||||
|
|
||||||
this.node = node;
|
this.node = node;
|
||||||
this.boostMultiplier = boostMultiplier;
|
this.boostMultiplier = boostMultiplier;
|
||||||
this.jobs = jobs;
|
setJobs(jobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNode() {
|
public String getNode() {
|
||||||
@ -135,7 +135,8 @@ public class JobItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setJobs(List<Job> jobs) {
|
public void setJobs(List<Job> jobs) {
|
||||||
this.jobs = jobs;
|
this.jobs.clear();
|
||||||
|
this.jobs.addAll(jobs == null ? new ArrayList<>() : jobs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<Enchantment, Integer> getEnchants() {
|
public HashMap<Enchantment, Integer> getEnchants() {
|
||||||
|
@ -539,14 +539,12 @@ public class JobsPlayer {
|
|||||||
public void promoteJob(Job job, int levels) {
|
public void promoteJob(Job job, int levels) {
|
||||||
// synchronized (saveLock) {
|
// synchronized (saveLock) {
|
||||||
JobProgression prog = getJobProgression(job);
|
JobProgression prog = getJobProgression(job);
|
||||||
if (prog == null)
|
if (prog == null || levels <= 0)
|
||||||
return;
|
return;
|
||||||
if (levels <= 0)
|
|
||||||
return;
|
|
||||||
int oldLevel = prog.getLevel();
|
|
||||||
int newLevel = oldLevel + levels;
|
|
||||||
|
|
||||||
int maxLevel = job.getMaxLevel(this);
|
int oldLevel = prog.getLevel(),
|
||||||
|
newLevel = oldLevel + levels,
|
||||||
|
maxLevel = job.getMaxLevel(this);
|
||||||
|
|
||||||
if (maxLevel > 0 && newLevel > maxLevel)
|
if (maxLevel > 0 && newLevel > maxLevel)
|
||||||
newLevel = maxLevel;
|
newLevel = maxLevel;
|
||||||
@ -563,10 +561,9 @@ public class JobsPlayer {
|
|||||||
public void demoteJob(Job job, int levels) {
|
public void demoteJob(Job job, int levels) {
|
||||||
// synchronized (saveLock) {
|
// synchronized (saveLock) {
|
||||||
JobProgression prog = getJobProgression(job);
|
JobProgression prog = getJobProgression(job);
|
||||||
if (prog == null)
|
if (prog == null || levels <= 0)
|
||||||
return;
|
|
||||||
if (levels <= 0)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int newLevel = prog.getLevel() - levels;
|
int newLevel = prog.getLevel() - levels;
|
||||||
if (newLevel < 1)
|
if (newLevel < 1)
|
||||||
newLevel = 1;
|
newLevel = 1;
|
||||||
@ -618,7 +615,6 @@ public class JobsPlayer {
|
|||||||
reloadLimits();
|
reloadLimits();
|
||||||
reloadHonorific();
|
reloadHonorific();
|
||||||
Jobs.getPermissionHandler().recalculatePermissions(this);
|
Jobs.getPermissionHandler().recalculatePermissions(this);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setRewardCmds(List<String> rewardCmds) {
|
public void setRewardCmds(List<String> rewardCmds) {
|
||||||
this.rewardCmds = rewardCmds;
|
this.rewardCmds.clear();
|
||||||
|
this.rewardCmds.addAll(rewardCmds == null ? new ArrayList<>() : rewardCmds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDescription() {
|
public List<String> getDescription() {
|
||||||
@ -56,7 +57,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(List<String> rewards) {
|
public void setDescription(List<String> rewards) {
|
||||||
this.rewards = rewards;
|
this.rewards.clear();
|
||||||
|
this.rewards.addAll(rewards == null ? new ArrayList<>() : rewards);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getRestrictedAreas() {
|
public List<String> getRestrictedAreas() {
|
||||||
@ -64,7 +66,8 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setRestrictedArea(List<String> area) {
|
public void setRestrictedArea(List<String> area) {
|
||||||
this.area = area;
|
this.area.clear();
|
||||||
|
this.area.addAll(area == null ? new ArrayList<>() : area);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getValidUntil() {
|
public Long getValidUntil() {
|
||||||
@ -95,7 +98,7 @@ public class Quest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Job getJob() {
|
public Job getJob() {
|
||||||
return Jobs.getJob(this.job.getName());
|
return Jobs.getJob(job.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setJob(Job job) {
|
public void setJob(Job job) {
|
||||||
@ -146,10 +149,10 @@ public class Quest {
|
|||||||
if (level == null)
|
if (level == null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (this.getMinLvl() != null && level < this.getMinLvl())
|
if (getMinLvl() != null && level < getMinLvl())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (this.getMaxLvl() != null && level > this.getMaxLvl())
|
if (getMaxLvl() != null && level > getMaxLvl())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -184,7 +187,7 @@ public class Quest {
|
|||||||
public void addObjective(QuestObjective objective) {
|
public void addObjective(QuestObjective objective) {
|
||||||
HashMap<String, QuestObjective> old = objectives.get(objective.getAction());
|
HashMap<String, QuestObjective> old = objectives.get(objective.getAction());
|
||||||
if (old == null) {
|
if (old == null) {
|
||||||
old = new HashMap<String, QuestObjective>();
|
old = new HashMap<>();
|
||||||
old.put(objective.getTargetName(), objective);
|
old.put(objective.getTargetName(), objective);
|
||||||
objectives.put(objective.getAction(), old);
|
objectives.put(objective.getAction(), old);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class QuestProgression {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getValidUntil() {
|
public Long getValidUntil() {
|
||||||
return this.validUntil;
|
return validUntil;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValidUntil(Long validUntil) {
|
public void setValidUntil(Long validUntil) {
|
||||||
@ -79,7 +79,7 @@ public class QuestProgression {
|
|||||||
public boolean isCompleted() {
|
public boolean isCompleted() {
|
||||||
for (Entry<ActionType, HashMap<String, QuestObjective>> oneA : quest.getObjectives().entrySet()) {
|
for (Entry<ActionType, HashMap<String, QuestObjective>> oneA : quest.getObjectives().entrySet()) {
|
||||||
for (Entry<String, QuestObjective> one : oneA.getValue().entrySet()) {
|
for (Entry<String, QuestObjective> one : oneA.getValue().entrySet()) {
|
||||||
Integer amountDone = this.done.get(one.getValue());
|
Integer amountDone = done.get(one.getValue());
|
||||||
if (amountDone == null || amountDone < one.getValue().getAmount())
|
if (amountDone == null || amountDone < one.getValue().getAmount())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -154,9 +154,6 @@ public class QuestProgression {
|
|||||||
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ev.getCommand().startsWith("/") ? ev.getCommand().substring(1) : ev.getCommand());
|
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), ev.getCommand().startsWith("/") ? ev.getCommand().substring(1) : ev.getCommand());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isGivenReward() {
|
public boolean isGivenReward() {
|
||||||
|
@ -16,19 +16,18 @@ public class ShopItem {
|
|||||||
private String IconMaterial = null;
|
private String IconMaterial = null;
|
||||||
private int IconAmount = 1;
|
private int IconAmount = 1;
|
||||||
private String IconName = null;
|
private String IconName = null;
|
||||||
private List<String> IconLore = new ArrayList<>();
|
private final List<String> IconLore = new ArrayList<>();
|
||||||
|
|
||||||
private boolean HideWithoutPerm = false;
|
private boolean HideWithoutPerm = false;
|
||||||
private boolean hideNoEnoughPoint = false;
|
private boolean hideNoEnoughPoint = false;
|
||||||
|
|
||||||
private int RequiredTotalLevels = -1;
|
private int RequiredTotalLevels = -1;
|
||||||
|
|
||||||
private List<String> RequiredPerm = new ArrayList<>();
|
|
||||||
private HashMap<String, Integer> RequiredJobs = new HashMap<>();
|
private HashMap<String, Integer> RequiredJobs = new HashMap<>();
|
||||||
|
|
||||||
private List<String> Commands = new ArrayList<>();
|
private final List<String> RequiredPerm = new ArrayList<>();
|
||||||
|
private final List<String> Commands = new ArrayList<>();
|
||||||
private List<JobItems> items = new ArrayList<>();
|
private final List<JobItems> items = new ArrayList<>();
|
||||||
|
|
||||||
private String PlayerName;
|
private String PlayerName;
|
||||||
private boolean useCurrentPlayer = false;
|
private boolean useCurrentPlayer = false;
|
||||||
@ -55,7 +54,8 @@ public class ShopItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setitems(List<JobItems> items) {
|
public void setitems(List<JobItems> items) {
|
||||||
this.items = items;
|
this.items.clear();
|
||||||
|
this.items.addAll(items == null ? new ArrayList<>() : items);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<JobItems> getitems() {
|
public List<JobItems> getitems() {
|
||||||
@ -63,7 +63,8 @@ public class ShopItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setCommands(List<String> Commands) {
|
public void setCommands(List<String> Commands) {
|
||||||
this.Commands = Commands;
|
this.Commands.clear();
|
||||||
|
this.Commands.addAll(Commands == null ? new ArrayList<>() : Commands);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCommands() {
|
public List<String> getCommands() {
|
||||||
@ -79,7 +80,8 @@ public class ShopItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setRequiredPerm(List<String> RequiredPerm) {
|
public void setRequiredPerm(List<String> RequiredPerm) {
|
||||||
this.RequiredPerm = RequiredPerm;
|
this.RequiredPerm.clear();
|
||||||
|
this.RequiredPerm.addAll(RequiredPerm == null ? new ArrayList<>() : RequiredPerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getRequiredPerm() {
|
public List<String> getRequiredPerm() {
|
||||||
@ -103,7 +105,8 @@ public class ShopItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setIconLore(List<String> IconLore) {
|
public void setIconLore(List<String> IconLore) {
|
||||||
this.IconLore = IconLore;
|
this.IconLore.clear();
|
||||||
|
this.IconLore.addAll(IconLore == null ? new ArrayList<>() : IconLore);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getIconLore() {
|
public List<String> getIconLore() {
|
||||||
|
@ -89,13 +89,13 @@ import java.util.*;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
public class JobsPaymentListener implements Listener {
|
public class JobsPaymentListener implements Listener {
|
||||||
|
|
||||||
private Jobs plugin;
|
private Jobs plugin;
|
||||||
public static final String furnaceOwnerMetadata = "jobsFurnaceOwner";
|
|
||||||
public static final String brewingOwnerMetadata = "jobsBrewingOwner";
|
public static final String furnaceOwnerMetadata = "jobsFurnaceOwner",
|
||||||
private final String BlockMetadata = "BlockOwner";
|
brewingOwnerMetadata = "jobsBrewingOwner", VegyMetadata = "VegyTimer";
|
||||||
public static final String VegyMetadata = "VegyTimer";
|
|
||||||
private final String CowMetadata = "CowTimer";
|
private final String BlockMetadata = "BlockOwner", CowMetadata = "CowTimer", entityDamageByPlayer = "JobsEntityDamagePlayer";
|
||||||
private final String entityDamageByPlayer = "JobsEntityDamagePlayer";
|
|
||||||
|
|
||||||
public JobsPaymentListener(Jobs plugin) {
|
public JobsPaymentListener(Jobs plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -618,9 +618,7 @@ public class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
int y = -1;
|
int y = -1;
|
||||||
|
|
||||||
CMIMaterial first = null;
|
CMIMaterial first = null, second = null, third = null;
|
||||||
CMIMaterial second = null;
|
|
||||||
CMIMaterial third = null;
|
|
||||||
|
|
||||||
boolean leather = false;
|
boolean leather = false;
|
||||||
boolean shulker = false;
|
boolean shulker = false;
|
||||||
@ -700,24 +698,19 @@ public class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// when we trying to craft tipped arrow effects
|
|
||||||
ItemStack currentItem = event.getCurrentItem();
|
|
||||||
if (currentItem != null) {
|
|
||||||
if (currentItem.hasItemMeta() && currentItem.getItemMeta() instanceof PotionMeta) {
|
|
||||||
PotionMeta potion = (PotionMeta) currentItem.getItemMeta();
|
|
||||||
Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType()));
|
|
||||||
} else {
|
|
||||||
Jobs.action(jPlayer, new ItemActionInfo(currentItem, ActionType.CRAFT));
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we need to pay only by each craft action we will skip calculation how much was crafted
|
// If we need to pay only by each craft action we will skip calculation how much was crafted
|
||||||
if (!Jobs.getGCManager().PayForEachCraft) {
|
if (!Jobs.getGCManager().PayForEachCraft) {
|
||||||
if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) {
|
ItemStack currentItem = event.getCurrentItem();
|
||||||
|
|
||||||
|
// when we trying to craft tipped arrow effects
|
||||||
|
if (currentItem != null && currentItem.hasItemMeta() && currentItem.getItemMeta() instanceof PotionMeta) {
|
||||||
|
PotionMeta potion = (PotionMeta) currentItem.getItemMeta();
|
||||||
|
Jobs.action(jPlayer, new PotionItemActionInfo(currentItem, ActionType.CRAFT, potion.getBasePotionData().getType()));
|
||||||
|
} else if (resultStack.hasItemMeta() && resultStack.getItemMeta().hasDisplayName()) {
|
||||||
Jobs.action(jPlayer, new ItemNameActionInfo(ChatColor.stripColor(resultStack.getItemMeta()
|
Jobs.action(jPlayer, new ItemNameActionInfo(ChatColor.stripColor(resultStack.getItemMeta()
|
||||||
.getDisplayName()), ActionType.CRAFT));
|
.getDisplayName()), ActionType.CRAFT));
|
||||||
|
} else if (currentItem != null) {
|
||||||
|
Jobs.action(jPlayer, new ItemActionInfo(currentItem, ActionType.CRAFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user