1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Merge pull request #1170 from Zrips/dev

Addition of Ignore-job-max and reverse world blacklist
This commit is contained in:
LogGitDev 2021-05-05 18:33:05 +10:00 committed by GitHub
commit 1896d57f93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 1410 additions and 1383 deletions

View File

@ -65,7 +65,7 @@ public class join implements Cmd {
return true;
}
if (!Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.progression.size())) {
if (!job.isIgnoreMaxJobs() && !Jobs.getPlayerManager().getJobsLimit(jPlayer, (short) jPlayer.progression.size())) {
pSender.sendMessage(Jobs.getLanguage().getMessage("command.join.error.maxjobs"));
return true;
}

File diff suppressed because it is too large Load Diff

View File

@ -86,10 +86,12 @@ public class Job {
private final List<String> fDescription = new ArrayList<>(), maxLevelCommands = new ArrayList<>();
private List<String> worldBlacklist = new ArrayList<>();
private boolean reversedWorldBlacklist = false;
private final List<Quest> quests = new ArrayList<>();
private int maxDailyQuests = 1;
private int id = 0;
private boolean ignoreMaxJobs = false;
@Deprecated
public Job(String jobName, String fullName, String jobShortName, String description, CMIChatColor jobColour, Parser maxExpEquation, DisplayMethod displayMethod, int maxLevel,
@ -643,17 +645,33 @@ public class Job {
}
public boolean isWorldBlackListed(Block block, Entity ent) {
if (worldBlacklist.isEmpty())
return false;
if (worldBlacklist.isEmpty())
return isReversedWorldBlacklist();
if (block != null && worldBlacklist.contains(block.getWorld().getName()))
return true;
if (block != null)
return worldBlacklist.contains(block.getWorld().getName()) != reversedWorldBlacklist;
return ent != null && worldBlacklist.contains(ent.getWorld().getName());
return ent != null && worldBlacklist.contains(ent.getWorld().getName()) != reversedWorldBlacklist;
}
public boolean isReversedWorldBlacklist() {
return reversedWorldBlacklist;
}
public void setReversedWorldBlacklist(boolean reversedWorldBlacklist) {
this.reversedWorldBlacklist = reversedWorldBlacklist;
}
public boolean isIgnoreMaxJobs() {
return ignoreMaxJobs;
}
public void setIgnoreMaxJobs(boolean ignoreMaxJobs) {
this.ignoreMaxJobs = ignoreMaxJobs;
}
@Override
public boolean equals(Object obj) {
return obj instanceof Job ? isSame((Job) obj) : false;
return obj instanceof Job && isSame((Job) obj);
}
}

View File

@ -3,7 +3,7 @@
# Edited by roracle to include 1.13 items and item names, preparing for 1.14 as well.
# ATTENTION!
# This is just an example job and will not be included into job list. Recomended to keep
# This is just an example job and will not be included into job list. Recommended to keep
# it around just for reference. Can be removed if needed.
# Must be one word. This job will be ignored as this is just example of all possible actions.
@ -575,12 +575,18 @@ exampleJob:
commands-on-max-level:
- 'msg [playerName] Max level of [job] reached!'
- 'player:jobs stats'
# Turns the "world-blacklist" list into a whitelist. This essentially means the job only works in the specified worlds.
reverse-world-blacklist-functionality: false
# World list in which this job will not work. World name should be exact
world-blacklist:
- plotworld
- teamworld
# Allow a player to "/jobs join" this job even if they have the max jobs permission reached.
ignore-jobs-max: false
# Limit item use to jobs level
limitedItems:
# Just name, don't have any impact