mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-12 13:43:57 +01:00
Add option for fellow party members to receive progress outside quest
This commit is contained in:
parent
cfb7be4272
commit
cad906965a
@ -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;
|
||||
}
|
||||
}
|
@ -208,7 +208,7 @@ public class Quest {
|
||||
|
||||
// Multiplayer
|
||||
if (opts.getShareProgressLevel() == 3) {
|
||||
List<Quester> mq = quester.getMultiplayerQuestersByQuest(this);
|
||||
List<Quester> mq = quester.getMultiplayerQuesters(this);
|
||||
for (Quester qq : mq) {
|
||||
if (currentStage.equals(qq.getCurrentStage(this))) {
|
||||
nextStage(qq, allowSharedProgress);
|
||||
@ -694,7 +694,7 @@ public class Quest {
|
||||
|
||||
// Multiplayer
|
||||
if (opts.getShareProgressLevel() == 4) {
|
||||
List<Quester> mq = q.getMultiplayerQuestersByQuest(this);
|
||||
List<Quester> mq = q.getMultiplayerQuesters(this);
|
||||
for (Quester qq : mq) {
|
||||
completeQuest(qq);
|
||||
}
|
||||
|
@ -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()) {
|
||||
|
@ -26,7 +26,6 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -3278,16 +3277,14 @@ public class Quester {
|
||||
* @param objectiveType The type of objective to progress
|
||||
* @param fun The function to execute, the event call
|
||||
*/
|
||||
public void dispatchMultiplayerEverything(String objectiveType, BiFunction<Quester, Quest, Void> fun) {
|
||||
Map<Quester, MultiplayerType> mq = getMultiplayerQuesters();
|
||||
for (Entry<Quester, MultiplayerType> q : mq.entrySet()) {
|
||||
for (Quest quest : q.getKey().getCurrentQuests().keySet()) {
|
||||
if (q.getKey().containsObjective(quest, objectiveType)
|
||||
&& quest.getOptions().getShareProgressLevel() == 1
|
||||
&& ((quest.getOptions().getUsePartiesPlugin() && q.getValue().parties)
|
||||
|| (quest.getOptions().getUseDungeonsXLPlugin() && q.getValue().dungeonxl))) {
|
||||
fun.apply(q.getKey(), quest);
|
||||
public void dispatchMultiplayerEverything(Quest quest, String objectiveType, Function<Quester, Void> fun) {
|
||||
if (quest.getOptions().getShareProgressLevel() == 1) {
|
||||
List<Quester> mq = getMultiplayerQuesters(quest);
|
||||
for (Quester q : mq) {
|
||||
if (q.containsObjective(quest, objectiveType) || !quest.getOptions().getRequireSameQuest()) {
|
||||
fun.apply(q);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3301,9 +3298,10 @@ public class Quester {
|
||||
*/
|
||||
public void dispatchMultiplayerObjectives(Quest quest, Stage currentStage, Function<Quester, Void> fun) {
|
||||
if (quest.getOptions().getShareProgressLevel() == 2) {
|
||||
List<Quester> mq = getMultiplayerQuestersByQuest(quest);
|
||||
List<Quester> mq = getMultiplayerQuesters(quest);
|
||||
for (Quester q : mq) {
|
||||
if (q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest))) {
|
||||
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest)))
|
||||
|| !quest.getOptions().getRequireSameQuest()) {
|
||||
fun.apply(q);
|
||||
}
|
||||
}
|
||||
@ -3315,7 +3313,7 @@ public class Quester {
|
||||
*
|
||||
* @return empty if no linked plugins, or party/group is null
|
||||
*/
|
||||
public Map<Quester, MultiplayerType> getMultiplayerQuesters() {
|
||||
/*public Map<Quester, MultiplayerType> getMultiplayerQuesters() {
|
||||
Map<Quester, MultiplayerType> ret = new LinkedHashMap<>();
|
||||
if (plugin.getDependencies().getPartiesApi() != null) {
|
||||
Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies().getPartiesApi().getPartyPlayer(getUUID()).getPartyName());
|
||||
@ -3342,7 +3340,7 @@ public class Quester {
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Get a map of fellow Questers in a party or group
|
||||
@ -3351,7 +3349,7 @@ public class Quester {
|
||||
* @param quest the quest to check
|
||||
* @return empty if no linked plugins, or party/group is null
|
||||
*/
|
||||
public List<Quester> getMultiplayerQuestersByQuest(Quest quest) {
|
||||
/*public List<Quester> getMultiplayerQuestersByQuest(Quest quest) {
|
||||
List<Quester> ret = new LinkedList<>();
|
||||
Map<Quester, MultiplayerType> mq = getMultiplayerQuesters();
|
||||
for (Entry<Quester, MultiplayerType> q : mq.entrySet()) {
|
||||
@ -3364,9 +3362,9 @@ public class Quester {
|
||||
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}*/
|
||||
|
||||
public class MultiplayerType {
|
||||
/*public class MultiplayerType {
|
||||
public boolean parties;
|
||||
public boolean dungeonxl;
|
||||
|
||||
@ -3374,6 +3372,47 @@ public class Quester {
|
||||
this.parties = parties;
|
||||
this.dungeonxl = dungeonxl;
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public List<Quester> getMultiplayerQuesters(Quest quest) {
|
||||
if (quest == null) {
|
||||
return null;
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
return mq;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getDependencies().getDungeonsApi() != null) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
return mq;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1946,6 +1946,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 {
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*******************************************************************************************************
|
||||
|
||||
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
@ -209,14 +210,14 @@ public class PlayerListener implements Listener {
|
||||
if (quester.containsObjective(quest, "useBlock")) {
|
||||
quester.useBlock(quest, blockItemStack);
|
||||
hasObjective = true;
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "useBlock", (Quester q) -> {
|
||||
q.useBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("useBlock", (Quester q, Quest quest) -> {
|
||||
q.useBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
if (!hasObjective) {
|
||||
if (plugin.getQuestFactory().getSelectedBlockStarts().containsKey(evt.getPlayer().getUniqueId())) {
|
||||
@ -365,14 +366,14 @@ public class PlayerListener implements Listener {
|
||||
}
|
||||
if (quester.containsObjective(quest, "password")) {
|
||||
quester.sayPassword(quest, evt);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "password", (Quester q) -> {
|
||||
q.sayPassword(quest, evt);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("password", (Quester q, Quest quest) -> {
|
||||
q.sayPassword(quest, evt);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -423,14 +424,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "damageBlock")) {
|
||||
quester.damageBlock(quest, blockItemStack);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("placeBlock", (Quester q, Quest quest) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,15 +446,15 @@ public class PlayerListener implements Listener {
|
||||
if (quester.containsObjective(quest, "placeBlock")) {
|
||||
if (evt.isCancelled() == false) {
|
||||
quester.placeBlock(quest, blockItemStack);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("placeBlock", (Quester q, Quest quest) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -469,6 +470,14 @@ public class PlayerListener implements Listener {
|
||||
if (quester.containsObjective(quest, "breakBlock")) {
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false) {
|
||||
quester.breakBlock(quest, blockItemStack);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "breakBlock", (Quester q) -> {
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false) {
|
||||
q.breakBlock(quest, blockItemStack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
if (quester.containsObjective(quest, "placeBlock")) {
|
||||
@ -477,40 +486,36 @@ public class PlayerListener implements Listener {
|
||||
int index = quester.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
is.setAmount(is.getAmount() - 1);
|
||||
quester.getQuestData(quest).blocksPlaced.set(index, is);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "placeBlock", (Quester q) -> {
|
||||
for (ItemStack is2 : q.getQuestData(quest).blocksPlaced) {
|
||||
if (evt.getBlock().getType().equals(is2.getType()) && is2.getAmount() > 0) {
|
||||
int index2 = q.getQuestData(quest).blocksPlaced.indexOf(is2);
|
||||
is2.setAmount(is2.getAmount() - 1);
|
||||
q.getQuestData(quest).blocksPlaced.set(index2, is2);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quester.containsObjective(quest, "cutBlock")) {
|
||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS)) {
|
||||
quester.cutBlock(quest, blockItemStack);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "cutBlock", (Quester q) -> {
|
||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS)) {
|
||||
q.cutBlock(quest, blockItemStack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("breakBlock", (Quester q, Quest quest) -> {
|
||||
if (evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false) {
|
||||
q.breakBlock(quest, blockItemStack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
quester.dispatchMultiplayerEverything("placeBlock", (Quester q, Quest quest) -> {
|
||||
for (ItemStack is : q.getQuestData(quest).blocksPlaced) {
|
||||
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
int index = q.getQuestData(quest).blocksPlaced.indexOf(is);
|
||||
is.setAmount(is.getAmount() - 1);
|
||||
q.getQuestData(quest).blocksPlaced.set(index, is);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
quester.dispatchMultiplayerEverything("cutBlock", (Quester q, Quest quest) -> {
|
||||
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS)) {
|
||||
q.cutBlock(quest, blockItemStack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -523,14 +528,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "shearSheep")) {
|
||||
quester.shearSheep(quest, sheep.getColor());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "shearSheep", (Quester q) -> {
|
||||
q.shearSheep(quest, sheep.getColor());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("shearSheep", (Quester q, Quest quest) -> {
|
||||
q.shearSheep(quest, sheep.getColor());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -544,14 +549,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "tameMob")) {
|
||||
quester.tameMob(quest, evt.getEntityType());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "tameMob", (Quester q) -> {
|
||||
q.tameMob(quest, evt.getEntityType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("tameMob", (Quester q, Quest quest) -> {
|
||||
q.tameMob(quest, evt.getEntityType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -567,14 +572,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "craftItem")) {
|
||||
quester.craftItem(quest, craftedItem);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "craftItem", (Quester q) -> {
|
||||
q.craftItem(quest, craftedItem);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("craftItem", (Quester q, Quest quest) -> {
|
||||
q.craftItem(quest, craftedItem);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -611,14 +616,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "smeltItem")) {
|
||||
quester.smeltItem(quest, evt.getCurrentItem());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "smeltItem", (Quester q) -> {
|
||||
q.smeltItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("smeltItem", (Quester q, Quest quest) -> {
|
||||
q.smeltItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
} else if (evt.getInventory().getType() == InventoryType.BREWING) {
|
||||
if (evt.getSlotType() == SlotType.CRAFTING) {
|
||||
@ -626,14 +631,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "brewItem")) {
|
||||
quester.brewItem(quest, evt.getCurrentItem());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "brewItem", (Quester q) -> {
|
||||
q.brewItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("brewItem", (Quester q, Quest quest) -> {
|
||||
q.brewItem(quest, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -647,17 +652,15 @@ public class PlayerListener implements Listener {
|
||||
if (quester.containsObjective(quest, "enchantItem")) {
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
quester.enchantItem(quest, e, evt.getItem().getType());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "enchantItem", (Quester q) -> {
|
||||
q.enchantItem(quest, e, evt.getItem().getType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("enchantItem", (Quester q, Quest quest) -> {
|
||||
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||
q.enchantItem(quest, e, evt.getItem().getType());
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -712,14 +715,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "killNPC")) {
|
||||
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "killNPC", (Quester q) -> {
|
||||
q.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("killNPC", (Quester q, Quest quest) -> {
|
||||
q.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
return null;
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -727,14 +730,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "killMob")) {
|
||||
quester.killMob(quest, target.getLocation(), target.getType());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "killMob", (Quester q) -> {
|
||||
q.killMob(quest, target.getLocation(), target.getType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("killMob", (Quester q, Quest quest) -> {
|
||||
q.killMob(quest, target.getLocation(), target.getType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -822,14 +825,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "killPlayer")) {
|
||||
quester.killPlayer(quest, (Player)target);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "killPlayer", (Quester q) -> {
|
||||
q.killPlayer(quest, (Player)target);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("killPlayer", (Quester q, Quest quest) -> {
|
||||
q.killPlayer(quest, (Player)target);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -841,14 +844,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||
quester.catchFish(quest);
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "catchFish", (Quester q) -> {
|
||||
q.catchFish(quest);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("catchFish", (Quester q, Quest quest) -> {
|
||||
q.catchFish(quest);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -973,14 +976,14 @@ public class PlayerListener implements Listener {
|
||||
for (Quest quest : quester.getCurrentQuests().keySet()) {
|
||||
if (quester.containsObjective(quest, "reachLocation")) {
|
||||
quester.reachLocation(quest, evt.getTo());
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, "reachLocation", (Quester q) -> {
|
||||
q.reachLocation(quest, evt.getTo());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything("reachLocation", (Quester q, Quest quest) -> {
|
||||
q.reachLocation(quest, evt.getTo());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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";
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user