mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-18 05:11:32 +01:00
Add reverse world blacklist system (#1167)
* Add reverse world blacklist system
This commit is contained in:
parent
45877b3602
commit
889470ae13
File diff suppressed because it is too large
Load Diff
@ -86,6 +86,7 @@ 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;
|
||||
@ -644,13 +645,21 @@ 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() {
|
||||
@ -663,6 +672,6 @@ public class Job {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Job ? isSame((Job) obj) : false;
|
||||
return obj instanceof Job && isSame((Job) obj);
|
||||
}
|
||||
}
|
||||
|
@ -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,7 +575,10 @@ 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
|
||||
|
Loading…
Reference in New Issue
Block a user