mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
Lets allow to disable each job separately in specific worlds
This commit is contained in:
parent
e4085da71c
commit
843b07b176
@ -799,9 +799,9 @@ public class Jobs extends JavaPlugin {
|
|||||||
getGCManager().reload();
|
getGCManager().reload();
|
||||||
getLanguage().reload();
|
getLanguage().reload();
|
||||||
try {
|
try {
|
||||||
getConfigManager().reload();
|
getConfigManager().reload();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
getDBManager().getDB().loadAllJobsWorlds();
|
getDBManager().getDB().loadAllJobsWorlds();
|
||||||
@ -909,6 +909,10 @@ public class Jobs extends JavaPlugin {
|
|||||||
|
|
||||||
if (noneJob == null)
|
if (noneJob == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (noneJob.isWorldBlackListed(block, ent) || noneJob.isWorldBlackListed(victim))
|
||||||
|
return;
|
||||||
|
|
||||||
JobInfo jobinfo = noneJob.getJobInfo(info, 1);
|
JobInfo jobinfo = noneJob.getJobInfo(info, 1);
|
||||||
|
|
||||||
checkDailyQuests(jPlayer, noneJob, info);
|
checkDailyQuests(jPlayer, noneJob, info);
|
||||||
@ -1002,6 +1006,10 @@ public class Jobs extends JavaPlugin {
|
|||||||
FastPayment.clear();
|
FastPayment.clear();
|
||||||
|
|
||||||
for (JobProgression prog : progression) {
|
for (JobProgression prog : progression) {
|
||||||
|
|
||||||
|
if (prog.getJob().isWorldBlackListed(block, ent) || prog.getJob().isWorldBlackListed(victim))
|
||||||
|
return;
|
||||||
|
|
||||||
int level = prog.getLevel();
|
int level = prog.getLevel();
|
||||||
|
|
||||||
JobInfo jobinfo = prog.getJob().getJobInfo(info, level);
|
JobInfo jobinfo = prog.getJob().getJobInfo(info, level);
|
||||||
|
@ -874,6 +874,13 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Commands
|
||||||
|
List<String> worldBlacklist = new ArrayList<>();
|
||||||
|
if(jobSection.isList("world-blacklist")) {
|
||||||
|
worldBlacklist = jobSection.getStringList("world-blacklist");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Items **OUTDATED** Moved to ItemBoostManager!!
|
// Items **OUTDATED** Moved to ItemBoostManager!!
|
||||||
HashMap<String, JobItems> jobItems = new HashMap<>();
|
HashMap<String, JobItems> jobItems = new HashMap<>();
|
||||||
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
|
ConfigurationSection itemsSection = jobSection.getConfigurationSection("items");
|
||||||
@ -979,7 +986,7 @@ public class ConfigManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Job job = new Job(jobKey, jobFullName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
Job job = new Job(jobKey, jobFullName, jobShortName, description, color, maxExpEquation, displayMethod, maxLevel, vipmaxLevel, maxSlots, jobPermissions, jobCommand,
|
||||||
jobConditions, jobItems, jobLimitedItems, JobsCommandOnJoin, JobsCommandOnLeave, GUIitem, bossbar, rejoinCd);
|
jobConditions, jobItems, jobLimitedItems, JobsCommandOnJoin, JobsCommandOnLeave, GUIitem, bossbar, rejoinCd, worldBlacklist);
|
||||||
|
|
||||||
job.setFullDescription(fDescription);
|
job.setFullDescription(fDescription);
|
||||||
job.setMoneyEquation(incomeEquation);
|
job.setMoneyEquation(incomeEquation);
|
||||||
|
@ -22,7 +22,9 @@ import com.gamingmesh.jobs.Jobs;
|
|||||||
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;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -63,6 +65,8 @@ public class Job {
|
|||||||
|
|
||||||
private List<String> fDescription = new ArrayList<>();
|
private List<String> fDescription = new ArrayList<>();
|
||||||
|
|
||||||
|
private List<String> worldBlacklist = new ArrayList<>();
|
||||||
|
|
||||||
private List<Quest> quests = new ArrayList<>();
|
private List<Quest> quests = new ArrayList<>();
|
||||||
private int maxDailyQuests = 1;
|
private int maxDailyQuests = 1;
|
||||||
|
|
||||||
@ -90,7 +94,7 @@ public class Job {
|
|||||||
*/
|
*/
|
||||||
public Job(String jobName, String fullName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
public Job(String jobName, String fullName, String jobShortName, String description, ChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
|
||||||
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems,
|
int vipmaxLevel, Integer maxSlots, List<JobPermission> jobPermissions, List<JobCommands> jobCommands, List<JobConditions> jobConditions, HashMap<String, JobItems> jobItems,
|
||||||
HashMap<String, JobLimitedItems> jobLimitedItems, List<String> CmdOnJoin, List<String> CmdOnLeave, ItemStack GUIitem, String bossbar, Long rejoinCD) {
|
HashMap<String, JobLimitedItems> jobLimitedItems, List<String> CmdOnJoin, List<String> CmdOnLeave, ItemStack GUIitem, String bossbar, Long rejoinCD, List<String> worldBlacklist) {
|
||||||
this.jobName = jobName;
|
this.jobName = jobName;
|
||||||
this.fullName = fullName;
|
this.fullName = fullName;
|
||||||
this.jobShortName = jobShortName;
|
this.jobShortName = jobShortName;
|
||||||
@ -111,6 +115,7 @@ public class Job {
|
|||||||
this.GUIitem = GUIitem;
|
this.GUIitem = GUIitem;
|
||||||
this.bossbar = bossbar;
|
this.bossbar = bossbar;
|
||||||
this.rejoinCd = rejoinCD;
|
this.rejoinCd = rejoinCD;
|
||||||
|
this.worldBlacklist = worldBlacklist;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addBoost(CurrencyType type, double Point) {
|
public void addBoost(CurrencyType type, double Point) {
|
||||||
@ -508,4 +513,29 @@ public class Job {
|
|||||||
if (id != 0)
|
if (id != 0)
|
||||||
Jobs.getJobsIds().put(id, this);
|
Jobs.getJobsIds().put(id, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getWorldBlacklist() {
|
||||||
|
return worldBlacklist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorldBlackListed(Entity ent) {
|
||||||
|
return isWorldBlackListed(null, ent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorldBlackListed(Block block) {
|
||||||
|
return isWorldBlackListed(block, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWorldBlackListed(Block block, Entity ent) {
|
||||||
|
if (worldBlacklist.isEmpty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (block != null && worldBlacklist.contains(block.getWorld().getName()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (ent != null && worldBlacklist.contains(ent.getWorld().getName()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -526,6 +526,10 @@ Jobs:
|
|||||||
- msg [player] Now you can use woodcutter kit!
|
- msg [player] Now you can use woodcutter kit!
|
||||||
levelFrom: 150
|
levelFrom: 150
|
||||||
levelUntil: 150
|
levelUntil: 150
|
||||||
|
# World list in which this job will not work. World name should be exact
|
||||||
|
world-blacklist:
|
||||||
|
- plotworld
|
||||||
|
- teamworld
|
||||||
# Getting more money when equipped with specific weapon/tool are wearing armor
|
# Getting more money when equipped with specific weapon/tool are wearing armor
|
||||||
items:
|
items:
|
||||||
# Just name, don't have any impact
|
# Just name, don't have any impact
|
||||||
|
Loading…
Reference in New Issue
Block a user