Merge pull request #940 from PikaMug/untested_v2

Majorly improve party functionality by @AlessioDP
This commit is contained in:
PikaMug 2019-09-19 13:04:43 -04:00 committed by GitHub
commit 73775e8e42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 3607 additions and 3244 deletions

View File

@ -1,157 +1,162 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.8.0</version>
</parent>
<artifactId>quests-main</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- Parties, GPS, PhatLoots, CitizensBooks, mcMMO Classic -->
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>citizens</id>
<url>http://repo.citizensnpcs.co/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>heroes-stripped</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
<repository>
<id>Vault</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId>
<version>2.0.21-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.denizenscript</groupId>
<artifactId>denizen</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.mcMMO-Dev</groupId>
<artifactId>mcMMO-Classic</artifactId>
<version>master-82f97cbe04-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.herocraftonline.heroes</groupId>
<artifactId>heroes-stripped</artifactId>
<version>4dd3dd85</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.nicuch</groupId>
<artifactId>CitizensBooks</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.PikaMug</groupId>
<artifactId>PhatLoots</artifactId>
<version>-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.DRE2N</groupId>
<artifactId>DungeonsXL</artifactId>
<version>-6523caa908-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.AlessioDP.Parties</groupId>
<artifactId>parties-api</artifactId>
<version>2.4.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>lang/**/*.*</include>
<include>config.yml</include>
<include>plugin.yml</include>
<include>actions.yml</include>
<include>quests.yml</include>
<include>data.yml</include>
<include>strings.yml</include>
</includes>
</resource>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/</directory>
<filtering>false</filtering>
<includes>
<include>README.md</include>
</includes>
</resource>
</resources>
</build>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>me.blackvein.quests</groupId>
<artifactId>quests-parent</artifactId>
<version>3.8.0</version>
</parent>
<artifactId>quests-main</artifactId>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<!-- GPS, PhatLoots, CitizensBooks, mcMMO Classic -->
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<!-- Parties repo -->
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>citizens</id>
<url>http://repo.citizensnpcs.co/</url>
</repository>
<repository>
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
<repository>
<id>heroes-stripped</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
<repository>
<id>Vault</id>
<url>http://nexus.hc.to/content/repositories/pub_releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.13.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.citizensnpcs</groupId>
<artifactId>citizens</artifactId>
<version>2.0.21-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.denizenscript</groupId>
<artifactId>denizen</artifactId>
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.mcMMO-Dev</groupId>
<artifactId>mcMMO-Classic</artifactId>
<version>master-82f97cbe04-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.herocraftonline.heroes</groupId>
<artifactId>heroes-stripped</artifactId>
<version>4dd3dd85</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.8.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.nicuch</groupId>
<artifactId>CitizensBooks</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.PikaMug</groupId>
<artifactId>PhatLoots</artifactId>
<version>-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.DRE2N</groupId>
<artifactId>DungeonsXL</artifactId>
<version>-6523caa908-1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.alessiodp.parties</groupId>
<artifactId>parties-api</artifactId>
<version>2.6.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>clean package install</defaultGoal>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<resources>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>lang/**/*.*</include>
<include>config.yml</include>
<include>plugin.yml</include>
<include>actions.yml</include>
<include>quests.yml</include>
<include>data.yml</include>
<include>strings.yml</include>
</includes>
</resource>
<resource>
<targetPath>.</targetPath>
<directory>${basedir}/</directory>
<filtering>false</filtering>
<includes>
<include>README.md</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -18,8 +18,10 @@ import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
public abstract class CustomObjective implements Listener {
@ -112,8 +114,6 @@ public abstract class CustomObjective implements Listener {
/**
* Check whether to let user set required amount for objective
*
* @param enableCount
*/
public boolean canShowCount() {
return showCount;
@ -122,7 +122,7 @@ public abstract class CustomObjective implements Listener {
/**
* Set whether to let user set required amount for objective
*
* @param enableCount
* @param showCount
*/
public void setShowCount(boolean showCount) {
this.showCount = showCount;
@ -216,8 +216,16 @@ public abstract class CustomObjective implements Listener {
}
}
if (index > -1) {
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= quester.getCurrentStage(quest).customObjectiveCounts.get(index)) {
quester.finishObjective(quest, "customObj", null, null, null, null, null, null, null, null, null, obj);
int goal = quester.getCurrentStage(quest).customObjectiveCounts.get(index);
if (quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()) >= goal) {
quester.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
// Multiplayer
quester.dispatchMultiplayerObjectives(quest, quester.getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).customObjectiveCounts.put(obj.getName(), quester.getQuestData(quest).customObjectiveCounts.get(obj.getName()));
q.finishObjective(quest, "customObj", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, goal), null, null, null, null, null, null, null, obj);
return null;
});
}
}
}

View File

@ -18,6 +18,7 @@ public class Options {
private boolean useDungeonsXLPlugin = false;
private boolean usePartiesPlugin = true;
private int shareProgressLevel = 1;
private boolean requireSameQuest = true;
public boolean getAllowCommands() {
return allowCommands;
@ -58,4 +59,12 @@ public class Options {
public void setShareProgressLevel(int shareProgressLevel) {
this.shareProgressLevel = shareProgressLevel;
}
public boolean getRequireSameQuest() {
return requireSameQuest;
}
public void setRequireSameQuest(boolean requireSameQuest) {
this.requireSameQuest = requireSameQuest;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -999,6 +999,7 @@ public class QuestFactory implements ConversationAbandonedListener {
boolean useDungeonsXLPluginOpt = false;
boolean usePartiesPluginOpt = true;
Integer shareProgressLevelOpt = 1;
boolean requireSameQuestOpt = true;
if (cc.getSessionData(CK.Q_START_NPC) != null) {
npcStart = (Integer) cc.getSessionData(CK.Q_START_NPC);
}
@ -1129,6 +1130,9 @@ public class QuestFactory implements ConversationAbandonedListener {
if (cc.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) != null) {
shareProgressLevelOpt = (Integer) cc.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL);
}
if (cc.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) != null) {
requireSameQuestOpt = (Boolean) cc.getSessionData(CK.OPT_REQUIRE_SAME_QUEST);
}
cs.set("name", name);
cs.set("npc-giver-id", npcStart);
cs.set("block-start", blockStart);
@ -1593,6 +1597,7 @@ public class QuestFactory implements ConversationAbandonedListener {
sch.set("use-dungeonsxl-plugin", useDungeonsXLPluginOpt);
sch.set("use-parties-plugin", usePartiesPluginOpt);
sch.set("share-progress-level", shareProgressLevelOpt);
sch.set("require-same-quest", requireSameQuestOpt);
}
@SuppressWarnings("deprecation")
@ -1713,6 +1718,7 @@ public class QuestFactory implements ConversationAbandonedListener {
cc.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.getUseDungeonsXLPlugin());
cc.setSessionData(CK.OPT_USE_PARTIES_PLUGIN, opt.getUsePartiesPlugin());
cc.setSessionData(CK.OPT_SHARE_PROGRESS_LEVEL, opt.getShareProgressLevel());
cc.setSessionData(CK.OPT_REQUIRE_SAME_QUEST, opt.getRequireSameQuest());
// Stages (Objectives)
int index = 1;
for (Stage stage : q.getStages()) {

View File

@ -26,6 +26,7 @@ import java.util.Random;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -932,8 +933,9 @@ public class Quester {
* Check if player's current stage has the specified objective<p>
*
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocation
* cutBlock, craftItem, smeltItem, enchantItem, brewItem, catchFish,
* killMob, deliverItem, killPlayer, talkToNPC, killNPC, tameMob,
* shearSheep, password, reachLocation
*
* @deprecated Use containsObjective() instead
* @param quest The quest to check objectives of
@ -948,8 +950,9 @@ public class Quester {
* Check if player's current stage has the specified objective<p>
*
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
* cutBlock, catchFish, enchantItem, killMob, deliverItem, killPlayer,
* talkToNPC, killNPC, tameMob, shearSheep, password, reachLocation
* cutBlock, craftItem, smeltItem, enchantItem, brewItem, catchFish,
* killMob, deliverItem, killPlayer, talkToNPC, killNPC, tameMob,
* shearSheep, password, reachLocation
*
* @param quest The quest to check objectives of
* @param s The type of objective to check for
@ -1068,24 +1071,21 @@ public class Quester {
}
}
if (broken.getAmount() < toBreak.getAmount()) {
ItemStack newBroken = broken;
final ItemStack newBroken = broken;
newBroken.setAmount(broken.getAmount() + 1);
if (getQuestData(quest).blocksBroken.contains(broken)) {
getQuestData(quest).blocksBroken.set(getQuestData(quest).blocksBroken.indexOf(broken), newBroken);
if (broken.getAmount() == toBreak.getAmount()) {
finishObjective(quest, "breakBlock", m, toBreak, null, null, null, null, null, null, null, null);
}
}
}
// Multiplayer
if (quest.getOptions().getShareProgressLevel() == 1) {
List<Quester> mq = getMultiplayerQuesters(quest);
if (mq != null) {
for (Quester q : mq) {
if (q.getCurrentQuests().containsKey(quest)) {
q.breakBlock(quest, m);
}
// Multiplayer
final ItemStack finalBroken = broken;
final ItemStack finalToBreak = toBreak;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).blocksBroken.set(getQuestData(quest).blocksBroken.indexOf(finalBroken), newBroken);
q.finishObjective(quest, "breakBlock", m, finalToBreak, null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1136,12 +1136,21 @@ public class Quester {
}
}
if (damaged.getAmount() < toDamage.getAmount()) {
ItemStack newDamaged = damaged;
final ItemStack newDamaged = damaged;
newDamaged.setAmount(damaged.getAmount() + 1);
if (getQuestData(quest).blocksDamaged.contains(damaged)) {
getQuestData(quest).blocksDamaged.set(getQuestData(quest).blocksDamaged.indexOf(damaged), newDamaged);
if (damaged.getAmount() == toDamage.getAmount()) {
finishObjective(quest, "damageBlock", m, toDamage, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalDamaged = damaged;
final ItemStack finalToDamage = toDamage;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).blocksDamaged.set(getQuestData(quest).blocksDamaged.indexOf(finalDamaged), newDamaged);
q.finishObjective(quest, "damageBlock", m, finalToDamage, null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1192,12 +1201,21 @@ public class Quester {
}
}
if (placed.getAmount() < toPlace.getAmount()) {
ItemStack newplaced = placed;
final ItemStack newplaced = placed;
newplaced.setAmount(placed.getAmount() + 1);
if (getQuestData(quest).blocksPlaced.contains(placed)) {
getQuestData(quest).blocksPlaced.set(getQuestData(quest).blocksPlaced.indexOf(placed), newplaced);
if (placed.getAmount() == toPlace.getAmount()) {
finishObjective(quest, "placeBlock", m, toPlace, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalPlaced = placed;
final ItemStack finalToPlace = toPlace;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).blocksPlaced.set(getQuestData(quest).blocksPlaced.indexOf(finalPlaced), newplaced);
q.finishObjective(quest, "damageBlock", m, finalToPlace, null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1248,12 +1266,21 @@ public class Quester {
}
}
if (used.getAmount() < toUse.getAmount()) {
ItemStack newUsed = used;
final ItemStack newUsed = used;
newUsed.setAmount(used.getAmount() + 1);
if (getQuestData(quest).blocksUsed.contains(used)) {
getQuestData(quest).blocksUsed.set(getQuestData(quest).blocksUsed.indexOf(used), newUsed);
if (used.getAmount() == toUse.getAmount()) {
finishObjective(quest, "useBlock", m, toUse, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalUsed = used;
final ItemStack finalToUse = toUse;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).blocksUsed.set(getQuestData(quest).blocksUsed.indexOf(finalUsed), newUsed);
q.finishObjective(quest, "useBlock", m, finalToUse, null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1304,12 +1331,21 @@ public class Quester {
}
}
if (cut.getAmount() < toCut.getAmount()) {
ItemStack newCut = cut;
final ItemStack newCut = cut;
newCut.setAmount(cut.getAmount() + 1);
if (getQuestData(quest).blocksCut.contains(cut)) {
getQuestData(quest).blocksCut.set(getQuestData(quest).blocksCut.indexOf(cut), newCut);
if (cut.getAmount() == toCut.getAmount()) {
finishObjective(quest, "cutBlock", m, toCut, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalCut = cut;
final ItemStack finalToCut = toCut;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).blocksCut.set(getQuestData(quest).blocksCut.indexOf(finalCut), newCut);
q.finishObjective(quest, "cutBlock", m, finalToCut, null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1345,6 +1381,14 @@ public class Quester {
if ((i.getAmount() + amount) >= req) {
getQuestData(quest).itemsCrafted.put(found, req);
finishObjective(quest, "craftItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalFound = found;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsCrafted.put(finalFound, req);
q.finishObjective(quest, "craftItem", new ItemStack(m, 1), finalFound, null, null, null, null, null, null, null, null);
return null;
});
} else {
getQuestData(quest).itemsCrafted.put(found, (amount + i.getAmount()));
}
@ -1382,6 +1426,14 @@ public class Quester {
if ((i.getAmount() + amount) >= req) {
getQuestData(quest).itemsSmelted.put(found, req);
finishObjective(quest, "smeltItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalFound = found;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsSmelted.put(finalFound, req);
q.finishObjective(quest, "smeltItem", new ItemStack(m, 1), finalFound, null, null, null, null, null, null, null, null);
return null;
});
} else {
getQuestData(quest).itemsSmelted.put(found, (amount + i.getAmount()));
}
@ -1405,7 +1457,16 @@ public class Quester {
Integer num = entry.getValue() + 1;
getQuestData(quest).itemsEnchanted.put(entry.getKey(), num);
if (num.equals(entry2.getValue())) {
finishObjective(quest, "enchantItem", new ItemStack(m, 1), null, e, null, null, null, null, null, null, null);
final ItemStack finalToEnchant = new ItemStack(m, entry.getValue());
finishObjective(quest, "enchantItem", new ItemStack(m, 1), finalToEnchant, e, null, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsEnchanted.put(entry.getKey(), num);
q.finishObjective(quest, "enchantItem", new ItemStack(m, 1), finalToEnchant, null, null, null, null, null, null, null, null);
return null;
});
}
}
break;
@ -1446,6 +1507,14 @@ public class Quester {
if ((i.getAmount() + amount) >= req) {
getQuestData(quest).itemsBrewed.put(found, req);
finishObjective(quest, "brewItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalFound = found;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsBrewed.put(finalFound, req);
q.finishObjective(quest, "brewItem", new ItemStack(m, 1), finalFound, null, null, null, null, null, null, null, null);
return null;
});
} else {
getQuestData(quest).itemsBrewed.put(found, (amount + i.getAmount()));
}
@ -1459,10 +1528,19 @@ public class Quester {
* @param quest The quest for which the fish is being caught
*/
public void catchFish(Quest quest) {
if (getQuestData(quest).getFishCaught() < getCurrentStage(quest).fishToCatch) {
final int fishToCatch = getCurrentStage(quest).fishToCatch;
if (getQuestData(quest).getFishCaught() < fishToCatch) {
getQuestData(quest).setFishCaught(getQuestData(quest).getFishCaught() + 1);
if (((Integer) getQuestData(quest).getFishCaught()).equals(getCurrentStage(quest).fishToCatch)) {
finishObjective(quest, "catchFish", null, null, null, null, null, null, null, null, null, null);
if (getQuestData(quest).getFishCaught() == fishToCatch) {
finishObjective(quest, "catchFish", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, fishToCatch), null, null, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).setFishCaught(fishToCatch);
q.finishObjective(quest, "catchFish", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, fishToCatch), null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1479,10 +1557,10 @@ public class Quester {
if (e == null) {
return;
}
if (questData.mobsKilled.contains(e) == false) {
Stage currentStage = getCurrentStage(quest);
if (currentStage.mobsToKill.contains(e) == false) {
return;
}
Stage currentStage = getCurrentStage(quest);
int indexOfMobKilled = questData.mobsKilled.indexOf(e);
int numberOfSpecificMobKilled = questData.mobNumKilled.get(indexOfMobKilled);
int numberOfSpecificMobNeedsToBeKilledInCurrentStage = currentStage.mobNumToKill.get(indexOfMobKilled);
@ -1505,10 +1583,19 @@ public class Quester {
}
}
if (numberOfSpecificMobKilled < numberOfSpecificMobNeedsToBeKilledInCurrentStage) {
Integer newNumberOfSpecificMobKilled = numberOfSpecificMobKilled + 1;
int newNumberOfSpecificMobKilled = numberOfSpecificMobKilled + 1;
questData.mobNumKilled.set(indexOfMobKilled, newNumberOfSpecificMobKilled);
if ((newNumberOfSpecificMobKilled).equals(numberOfSpecificMobNeedsToBeKilledInCurrentStage)) {
finishObjective(quest, "killMob", null, null, null, e, null, null, null, null, null, null);
if (newNumberOfSpecificMobKilled == numberOfSpecificMobNeedsToBeKilledInCurrentStage) {
finishObjective(quest, "killMob", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, numberOfSpecificMobNeedsToBeKilledInCurrentStage), null, e, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, currentStage, (Quester q) -> {
q.getQuestData(quest).mobNumKilled.set(indexOfMobKilled, newNumberOfSpecificMobKilled);
q.finishObjective(quest, "killMob", new ItemStack(Material.AIR, 1),
new ItemStack(Material.AIR, numberOfSpecificMobNeedsToBeKilledInCurrentStage), null, e, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1520,10 +1607,18 @@ public class Quester {
* @param player The player to be killed
*/
public void killPlayer(Quest quest, Player player) {
if (getQuestData(quest).getPlayersKilled() < getCurrentStage(quest).playersToKill) {
final int playersToKill = getCurrentStage(quest).playersToKill;
if (getQuestData(quest).getPlayersKilled() < playersToKill) {
getQuestData(quest).setPlayersKilled(getQuestData(quest).getPlayersKilled() + 1);
if (((Integer) getQuestData(quest).getPlayersKilled()).equals(getCurrentStage(quest).playersToKill)) {
finishObjective(quest, "killPlayer", null, null, null, null, null, null, null, null, null, null);
if (getQuestData(quest).getPlayersKilled() == playersToKill) {
finishObjective(quest, "killPlayer", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, playersToKill), null, null, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).setPlayersKilled(getQuestData(quest).getPlayersKilled());
q.finishObjective(quest, "killPlayer", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, playersToKill), null, null, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1565,17 +1660,23 @@ public class Quester {
+ " when delivering for quest " + quest.getName());
return;
}
if ((i.getAmount() + amount) > req) {
if ((i.getAmount() + amount) >= req) {
getQuestData(quest).itemsDelivered.put(found, req);
i.setAmount(i.getAmount() - (req - amount)); // Take away the remaining amount needed to be delivered
player.getInventory().setItem(index, i);
player.updateInventory();
finishObjective(quest, "deliverItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
} else if ((i.getAmount() + amount) == req) {
getQuestData(quest).itemsDelivered.put(found, req);
player.getInventory().setItem(index, null);
if ((i.getAmount() + amount) >= req) {
i.setAmount(i.getAmount() - (req - amount)); // Take away the remaining amount needed to be delivered
player.getInventory().setItem(index, i);
} else {
player.getInventory().setItem(index, null);
}
player.updateInventory();
finishObjective(quest, "deliverItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsDelivered.put(found, req);
q.finishObjective(quest, "deliverItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
return null;
});
} else {
getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount()));
player.getInventory().setItem(index, null);
@ -1620,16 +1721,23 @@ public class Quester {
if (amount < req) {
if ((i.getAmount() + amount) > req) {
getQuestData(quest).itemsDelivered.put(found, req);
int index = player.getInventory().first(i);
i.setAmount(i.getAmount() - (req - amount)); // Take away the remaining amount needed to be delivered
player.getInventory().setItem(index, i);
player.updateInventory();
finishObjective(quest, "deliverItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
} else if ((i.getAmount() + amount) == req) {
getQuestData(quest).itemsDelivered.put(found, req);
player.getInventory().setItem(player.getInventory().first(i), null);
if ((i.getAmount() + amount) > req) {
int index = player.getInventory().first(i);
i.setAmount(i.getAmount() - (req - amount)); // Take away the remaining amount needed to be delivered
player.getInventory().setItem(index, i);
} else {
player.getInventory().setItem(player.getInventory().first(i), null);
}
player.updateInventory();
finishObjective(quest, "deliverItem", new ItemStack(m, 1), found, null, null, null, null, null, null, null, null);
// Multiplayer
final ItemStack finalFound = found;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).itemsDelivered.put(finalFound, req);
q.finishObjective(quest, "deliverItem", new ItemStack(m, 1), finalFound, null, null, null, null, null, null, null, null);
return null;
});
} else {
getQuestData(quest).itemsDelivered.put(found, (amount + i.getAmount()));
player.getInventory().setItem(player.getInventory().first(i), null);
@ -1654,7 +1762,14 @@ public class Quester {
Boolean b = getQuestData(quest).citizensInteracted.get(n.getId());
if (b != null && !b) {
getQuestData(quest).citizensInteracted.put(n.getId(), true);
finishObjective(quest, "talkToNPC", null, null, null, null, null, n, null, null, null, null);
finishObjective(quest, "talkToNPC", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, n, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).citizensInteracted.put(n.getId(), true);
q.finishObjective(quest, "talkToNPC", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, n, null, null, null, null);
return null;
});
}
}
}
@ -1668,10 +1783,18 @@ public class Quester {
public void killNPC(Quest quest, NPC n) {
if (getQuestData(quest).citizensKilled.contains(n.getId())) {
int index = getQuestData(quest).citizensKilled.indexOf(n.getId());
if (getQuestData(quest).citizenNumKilled.get(index) < getCurrentStage(quest).citizenNumToKill.get(index)) {
final int npcsToKill = getCurrentStage(quest).citizenNumToKill.get(index);
if (getQuestData(quest).citizenNumKilled.get(index) < npcsToKill) {
getQuestData(quest).citizenNumKilled.set(index, getQuestData(quest).citizenNumKilled.get(index) + 1);
if (getQuestData(quest).citizenNumKilled.get(index) == getCurrentStage(quest).citizenNumToKill.get(index)) {
finishObjective(quest, "killNPC", null, null, null, null, null, n, null, null, null, null);
if (getQuestData(quest).citizenNumKilled.get(index).equals(npcsToKill)) {
finishObjective(quest, "killNPC", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, npcsToKill), null, null, null, n, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).citizenNumKilled.set(index, getQuestData(quest).citizenNumKilled.get(index));
q.finishObjective(quest, "killNPC", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, npcsToKill), null, null, null, n, null, null, null, null);
return null;
});
}
}
}
@ -1681,7 +1804,7 @@ public class Quester {
* Mark location as reached if the Quester has such an objective
*
* @param quest The quest for which the location is being reached
* @param n The location being reached
* @param l The location being reached
*/
public void reachLocation(Quest quest, Location l) {
if (getQuestData(quest).locationsReached == null) {
@ -1708,7 +1831,19 @@ public class Quester {
} else {
getQuestData(quest).hasReached.set(index, true);
}
finishObjective(quest, "reachLocation", null, null, null, null, null, null, location, null, null, null);
finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, null, location, null, null, null);
// Multiplayer
final int finalIndex = index;
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
if (finalIndex >= getQuestData(quest).hasReached.size()) {
q.getQuestData(quest).hasReached.add(true);
} else {
q.getQuestData(quest).hasReached.set(finalIndex, true);
}
q.finishObjective(quest, "reachLocation", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, null, location, null, null, null);
return null;
});
}
}
}
@ -1735,8 +1870,16 @@ public class Quester {
public void tameMob(Quest quest, EntityType entity) {
if (getQuestData(quest).mobsTamed.containsKey(entity)) {
getQuestData(quest).mobsTamed.put(entity, (getQuestData(quest).mobsTamed.get(entity) + 1));
if (getQuestData(quest).mobsTamed.get(entity).equals(getCurrentStage(quest).mobsToTame.get(entity))) {
finishObjective(quest, "tameMob", null, null, null, entity, null, null, null, null, null, null);
final int mobsToTame = getCurrentStage(quest).mobsToTame.get(entity);
if (getQuestData(quest).mobsTamed.get(entity).equals(mobsToTame)) {
finishObjective(quest, "tameMob", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, mobsToTame), null, entity, null, null, null, null, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).mobsTamed.put(entity, getQuestData(quest).mobsTamed.get(entity));
q.finishObjective(quest, "tameMob", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, mobsToTame), null, entity, null, null, null, null, null, null);
return null;
});
}
}
}
@ -1750,8 +1893,16 @@ public class Quester {
public void shearSheep(Quest quest, DyeColor color) {
if (getQuestData(quest).sheepSheared.containsKey(color)) {
getQuestData(quest).sheepSheared.put(color, (getQuestData(quest).sheepSheared.get(color) + 1));
if (getQuestData(quest).sheepSheared.get(color).equals(getCurrentStage(quest).sheepToShear.get(color))) {
finishObjective(quest, "shearSheep", null, null, null, null, null, null, null, color, null, null);
final int sheepToShear = getCurrentStage(quest).sheepToShear.get(color);
if (getQuestData(quest).sheepSheared.get(color).equals(sheepToShear)) {
finishObjective(quest, "shearSheep", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, sheepToShear), null, null, null, null, null, color, null, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).sheepSheared.put(color, getQuestData(quest).sheepSheared.get(color));
q.finishObjective(quest, "shearSheep", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, sheepToShear), null, null, null, null, null, color, null, null);
return null;
});
}
}
}
@ -1772,12 +1923,15 @@ public class Quester {
String display = getCurrentStage(quest).passwordDisplays.get(getCurrentStage(quest).passwordPhrases.indexOf(passes));
getQuestData(quest).passwordsSaid.put(display, true);
done = true;
plugin.getServer().getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
finishObjective(quest, "password", null, null, null, null, null, null, null, null, display, null);
}
plugin.getServer().getScheduler().runTask(plugin, () -> {
finishObjective(quest, "password", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, null, null, null, display, null);
// Multiplayer
dispatchMultiplayerObjectives(quest, getCurrentStage(quest), (Quester q) -> {
q.getQuestData(quest).passwordsSaid.put(display, true);
q.finishObjective(quest, "password", new ItemStack(Material.AIR, 1), new ItemStack(Material.AIR, 1), null, null, null, null, null, null, display, null);
return null;
});
});
break;
}
@ -1891,7 +2045,7 @@ public class Quester {
ench.put(enchantment, enchantment.getStartLevel());
for (Map<Enchantment, Material> map : getCurrentStage(quest).itemsToEnchant.keySet()) {
if (map.containsKey(enchantment)) {
message = message + " " + getCurrentStage(quest).itemsToEnchant.get(map) + "/" + getCurrentStage(quest).itemsToEnchant.get(map);
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
break;
}
}
@ -1922,11 +2076,11 @@ public class Quester {
}
} else if (objective.equalsIgnoreCase("catchFish")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "catchFish") + " ";
message = message + " " + getCurrentStage(quest).fishToCatch + "/" + getCurrentStage(quest).fishToCatch;
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("killMob")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " <mob>";
message = message + " " + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)) + "/" + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob));
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateItems()) {
plugin.getLocaleQuery().sendMessage(p, message, mob, extra);
} else {
@ -1934,7 +2088,7 @@ public class Quester {
}
} else if (objective.equalsIgnoreCase("killPlayer")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "killPlayer");
message = message + " " + getCurrentStage(quest).playersToKill + "/" + getCurrentStage(quest).playersToKill;
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("talkToNPC")) {
String obj = Lang.get(p, "talkTo");
@ -1943,11 +2097,11 @@ public class Quester {
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("killNPC")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " " + npc.getName();
message = message + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId())) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId()));
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("tameMob")) {
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame") + " <mob>";
message = message + " " + getCurrentStage(quest).mobsToTame.get(mob) + "/" + getCurrentStage(quest).mobsToTame.get(mob);
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
if (plugin.getSettings().canTranslateItems()) {
plugin.getLocaleQuery().sendMessage(p, message, mob, extra);
} else {
@ -1957,7 +2111,7 @@ public class Quester {
String obj = Lang.get(p, "shearSheep");
obj = obj.replace("<color>", color.name().toLowerCase());
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
message = message + " " + getCurrentStage(quest).sheepToShear.get(color) + "/" + getCurrentStage(quest).sheepToShear.get(color);
message = message + " " + goal.getAmount() + "/" + goal.getAmount();
p.sendMessage(message);
} else if (objective.equalsIgnoreCase("reachLocation")) {
String obj = Lang.get(p, "goTo");
@ -1982,24 +2136,12 @@ public class Quester {
}
if (co.canShowCount()) {
message = message.replace("%count%", getCurrentStage(quest).customObjectiveCounts.get(index) + "/" + getCurrentStage(quest).customObjectiveCounts.get(index));
message = message.replace("%count%", goal.getAmount() + "/" + goal.getAmount());
}
p.sendMessage(message);
}
if (testComplete(quest)) {
quest.nextStage(this);
}
// Multiplayer
if (quest.getOptions().getShareProgressLevel() == 2) {
List<Quester> mq = getMultiplayerQuesters(quest);
if (mq != null) {
for (Quester q : mq) {
if (q.getCurrentQuests().containsKey(quest)) {
quest.nextStage(q);
}
}
}
quest.nextStage(this, true);
}
}
@ -3124,21 +3266,67 @@ public class Quester {
return playerAmount >= is.getAmount();
}
/**
* Dispatch player event to fellow questers<p>
*
* Accepted strings are: breakBlock, damageBlock, placeBlock, useBlock,
* cutBlock, craftItem, smeltItem, enchantItem, brewItem, catchFish,
* killMob, deliverItem, killPlayer, talkToNPC, killNPC, tameMob,
* shearSheep, password, reachLocation
*
* @param objectiveType The type of objective to progress
* @param fun The function to execute, the event call
*/
public void dispatchMultiplayerEverything(Quest quest, String objectiveType, Function<Quester, Void> fun) {
if (quest.getOptions().getShareProgressLevel() == 1) {
List<Quester> mq = getMultiplayerQuesters(quest);
if (mq == null) {
return;
}
for (Quester q : mq) {
if (q.containsObjective(quest, objectiveType)) {
if (!quest.getOptions().getRequireSameQuest() || this.containsObjective(quest, objectiveType)) {
fun.apply(q);
}
}
}
}
}
/**
* Dispatch finish objective to fellow questers
*
* @param quest The current quest
* @param currentStage The current stage of the quest
* @param fun The function to execute, the event call
*/
public void dispatchMultiplayerObjectives(Quest quest, Stage currentStage, Function<Quester, Void> fun) {
if (quest.getOptions().getShareProgressLevel() == 2) {
List<Quester> mq = getMultiplayerQuesters(quest);
for (Quester q : mq) {
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest)))
|| !quest.getOptions().getRequireSameQuest()) {
fun.apply(q);
}
}
}
}
/**
* Get a list of follow Questers in a party or group
*
* @param quest The quest which uses a linked plugin, i.e. Parties or DungeonsXL
* @return null if quest is null, no linked plugins, or party/group is null
* @return Potentially empty list of Questers or null for invalid quest
*/
public List<Quester> getMultiplayerQuesters(Quest quest) {
if (quest == null) {
return null;
}
List<Quester> mq = new LinkedList<Quester>();
if (plugin.getDependencies().getPartiesApi() != null) {
if (quest.getOptions().getUsePartiesPlugin()) {
Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies().getPartiesApi().getPartyPlayer(getUUID()).getPartyName());
if (party != null) {
List<Quester> mq = new LinkedList<Quester>();
for (UUID id : party.getMembers()) {
if (!id.equals(getUUID())) {
mq.add(plugin.getQuester(id));
@ -3152,7 +3340,6 @@ public class Quester {
if (quest.getOptions().getUseDungeonsXLPlugin()) {
DGroup group = DGroup.getByPlayer(getPlayer());
if (group != null) {
List<Quester> mq = new LinkedList<Quester>();
for (UUID id : group.getPlayers()) {
if (!id.equals(getUUID())) {
mq.add(plugin.getQuester(id));
@ -3162,7 +3349,7 @@ public class Quester {
}
}
}
return null;
return mq;
}
/**

View File

@ -1339,9 +1339,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
/**
* Reload quests, player data, actions, config settings, lang and modules, in that order
* Reload quests, actions, config settings, lang and modules, and player data
*/
public void reloadQuests() {
for (Quester quester : questers) {
quester.saveData();
}
quests.clear();
events.clear();
@ -1360,6 +1363,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
loadModules();
for (Quester quester : questers) {
quester.loadData();
for (Quest q : quester.currentQuests.keySet()) {
quester.checkQuest(q);
}
@ -1465,6 +1469,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
try { // main "skip quest" try/catch block
Quest quest = new Quest();
failedToLoad = false;
quest.id = questKey;
if (config.contains("quests." + questKey + ".name")) {
quest.setName(parseString(config.getString("quests." + questKey + ".name"), quest));
} else {
@ -1946,6 +1951,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.contains("quests." + questKey + ".options.share-progress-level")) {
opts.setShareProgressLevel(config.getInt("quests." + questKey + ".options.share-progress-level"));
}
if (config.contains("quests." + questKey + ".options.require-same-quest")) {
opts.setRequireSameQuest(config.getBoolean("quests." + questKey + ".options.require-same-quest"));
}
}
private void skipQuestProcess(String[] msgs) throws SkipQuest {

View File

@ -339,7 +339,7 @@ public class OptionsPrompt extends NumericPrompt {
public class MultiplayerPrompt extends NumericPrompt {
private final int size = 4;
private final int size = 5;
public int getSize() {
return size;
@ -358,6 +358,8 @@ public class OptionsPrompt extends NumericPrompt {
case 3:
return ChatColor.BLUE;
case 4:
return ChatColor.BLUE;
case 5:
return ChatColor.GREEN;
default:
return null;
@ -397,6 +399,16 @@ public class OptionsPrompt extends NumericPrompt {
+ ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.YELLOW + ")";
}
case 4:
if (context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) == null) {
boolean defaultOpt = new Options().getRequireSameQuest();
return ChatColor.YELLOW + Lang.get("optRequireSameQuest") + " ("
+ (defaultOpt ? ChatColor.GREEN + String.valueOf(defaultOpt) : ChatColor.RED + String.valueOf(defaultOpt)) + ChatColor.YELLOW + ")";
} else {
boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST);
return ChatColor.YELLOW + Lang.get("optRequireSameQuest") + " ("
+ (requireOpt ? ChatColor.GREEN + String.valueOf(requireOpt) : ChatColor.RED + String.valueOf(requireOpt)) + ChatColor.YELLOW + ")";
}
case 5:
return ChatColor.YELLOW + Lang.get("done");
default:
return null;
@ -431,6 +443,10 @@ public class OptionsPrompt extends NumericPrompt {
tempPrompt = new MultiplayerPrompt();
return new LevelPrompt();
case 4:
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
tempPrompt = new MultiplayerPrompt();
return new TrueFalsePrompt();
case 5:
tempKey = null;
tempPrompt = null;
try {

View File

@ -137,6 +137,7 @@ public class CK {
public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt";
public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt";
public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt";
public static final String OPT_REQUIRE_SAME_QUEST = "requireSameQuestOpt";
// Events
public static final String E_OLD_EVENT = "oldEvent";
public static final String E_NAME = "evtName";

View File

@ -475,6 +475,7 @@ optCommandsDenied: "You cannot use commands during <quest>."
optUseDungeonsXLPlugin: "Use DungeonsXL plugin"
optUsePartiesPlugin: "Use Parties plugin"
optShareProgressLevel: "Level of progress sharing"
optRequireSameQuest: "Require same quest"
rewSetMoney: "Set money reward"
rewSetQuestPoints: "Set Quest Points reward"
rewSetItems: "Set item rewards"