Parties 3.0.0 support (#1555)

* Updated Parties support

* Fixed multiplayer everything

* Add missing space for legacy string, fixes #1516

* Address formatting problems in initial menu prompts

* Do not proceed on invalid entity type, fixes #1520

* Click to register NPC listener if Citizens link failed at startup

* Populate objective goals when retrieving fresh quest data, fixes #1515

* Fixed typo in quest points log

* Added new Parties options for offline players and distance

* Added Parties experience reward

* Fix error on last stage completion

* Fixed Parties distance calculation

* Reworked how multiplayer sharing 1 works and require same quest

* Properly store repeat/cooldown values greater than max int, fixes #1523

* New Crowdin updates (#1524)

* New translations strings.yml (Thai)

* New translations strings.yml (Estonian)

* New translations strings.yml (Thai)

* New translations strings.yml (Thai)

* New translations strings.yml (Thai)

* Update quest main prompt strings

* Update quest main prompt strings, part 2

* Update quest main prompt strings, part 3

* New Crowdin updates (#1525)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Hindi)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Estonian)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (English)

* New translations strings.yml (Arabic)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Sinhala)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Hindi)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Estonian)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (English)

* New translations strings.yml (Arabic)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Sinhala)

* Update README.md

* NEW load shared quests to memory via /import folder

* Provide additional context for failed requirement quests, fixes #1530

* Use quest IDs instead of names for YAML implementation of quester data

* Remove initial action from main quests prompt, functional as legacy only

* New Crowdin updates (#1533)

* New translations strings.yml (Polish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Spanish)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Estonian)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (English)

* New translations strings.yml (Turkish)

* New translations strings.yml (Romanian)

* New translations strings.yml (Hungarian)

* New translations strings.yml (French)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Sinhala)

* New translations strings.yml (English)

* New translations strings.yml (Pirate English)

* Call password objective event on sync to prevent exception

* Address certain objectives not progressing, fixes #1535

* Update quest completion messages to adhere to modern strings

* Correct erroneous enchantment string functionality, fixes #1538

* New Crowdin updates (#1543)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (Estonian)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (Romanian)

* New translations strings.yml (Arabic)

* New translations strings.yml (Finnish)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Sinhala)

* New Crowdin updates (#1544)

* New translations strings.yml (Polish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Spanish)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (English)

* New translations strings.yml (Turkish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Russian)

* Bump version

* Add missing disable-command-feedback config check (#1547)

* Translate quest item reward name if applicable, fixes #1548

* Prevent sending of most empty quester strings, fixes #1545

* New Crowdin updates (#1551)

* New translations strings.yml (Polish)

* New translations strings.yml (Pirate English)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Croatian)

* New translations strings.yml (Hindi)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (Serbian (Latin))

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Spanish)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Estonian)

* New translations strings.yml (Norwegian Bokmal)

* New translations strings.yml (English)

* New translations strings.yml (Turkish)

* New translations strings.yml (Romanian)

* New translations strings.yml (Hungarian)

* New translations strings.yml (French)

* New translations strings.yml (Arabic)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Finnish)

* New translations strings.yml (Italian)

* New translations strings.yml (Swedish)

* New translations strings.yml (Japanese)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Portuguese)

* New translations strings.yml (Russian)

* New translations strings.yml (Serbian (Cyrillic))

* New translations strings.yml (Sinhala)

* New translations strings.yml (Polish)

* New translations strings.yml (Vietnamese)

* New translations strings.yml (Portuguese, Brazilian)

* New translations strings.yml (Indonesian)

* New translations strings.yml (Thai)

* New translations strings.yml (Filipino)

* New translations strings.yml (Chinese Simplified)

* New translations strings.yml (LOLCAT)

* New translations strings.yml (Spanish)

* New translations strings.yml (Chinese Traditional)

* New translations strings.yml (Estonian)

* New translations strings.yml (Turkish)

* New translations strings.yml (Hungarian)

* New translations strings.yml (French)

* New translations strings.yml (Czech)

* New translations strings.yml (Danish)

* New translations strings.yml (German)

* New translations strings.yml (Italian)

* New translations strings.yml (Korean)

* New translations strings.yml (Dutch)

* New translations strings.yml (Russian)

* Fixed multiplayer everything

* Reworked how multiplayer sharing 1 works and require same quest

* Updated Parties dependency

* Improved Parties messages on join/leave

* Further fixes about multiplayer sharing

* Wrong method fix

* Fixed documentation about deprecated method

Co-authored-by: PikaMug <2267126+PikaMug@users.noreply.github.com>
Co-authored-by: datatags <datatags@users.noreply.github.com>
This commit is contained in:
AlessioDP 2021-01-11 05:15:58 +01:00 committed by GitHub
parent 5d29779bc8
commit 733aa326da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 746 additions and 605 deletions

View File

@ -18,11 +18,6 @@
<id>jitpack.io</id> <id>jitpack.io</id>
<url>https://jitpack.io</url> <url>https://jitpack.io</url>
</repository> </repository>
<repository>
<!-- Parties -->
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
<repository> <repository>
<id>spigot-repo</id> <id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
@ -35,6 +30,11 @@
<id>sk89q-repo</id> <id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url> <url>http://maven.sk89q.com/repo/</url>
</repository> </repository>
<repository>
<!-- Parties -->
<id>alessiodp-repo</id>
<url>https://repo.alessiodp.com/releases/</url>
</repository>
<repository> <repository>
<id>placeholderapi</id> <id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url> <url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@ -119,7 +119,7 @@
<dependency> <dependency>
<groupId>com.alessiodp.parties</groupId> <groupId>com.alessiodp.parties</groupId>
<artifactId>parties-api</artifactId> <artifactId>parties-api</artifactId>
<version>2.6.3</version> <version>3.0.0-rc.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -18,8 +18,10 @@ public class Options {
private boolean ignoreSilkTouch = true; private boolean ignoreSilkTouch = true;
private boolean useDungeonsXLPlugin = false; private boolean useDungeonsXLPlugin = false;
private boolean usePartiesPlugin = true; private boolean usePartiesPlugin = true;
private boolean partiesHandleOfflinePlayers = false;
private long partiesDistance = 0;
private int shareProgressLevel = 1; private int shareProgressLevel = 1;
private boolean requireSameQuest = true; private boolean shareOnlySameQuest = true;
public boolean canAllowCommands() { public boolean canAllowCommands() {
return allowCommands; return allowCommands;
@ -61,6 +63,22 @@ public class Options {
this.usePartiesPlugin = usePartiesPlugin; this.usePartiesPlugin = usePartiesPlugin;
} }
public boolean canPartiesHandleOfflinePlayers() {
return partiesHandleOfflinePlayers;
}
public void setPartiesHandleOfflinePlayers(final boolean partiesHandleOfflinePlayers) {
this.partiesHandleOfflinePlayers = partiesHandleOfflinePlayers;
}
public long getPartiesDistance() {
return partiesDistance;
}
public void setPartiesDistance(final long partiesDistance) {
this.partiesDistance = partiesDistance;
}
public int getShareProgressLevel() { public int getShareProgressLevel() {
return shareProgressLevel; return shareProgressLevel;
} }
@ -69,11 +87,11 @@ public class Options {
this.shareProgressLevel = shareProgressLevel; this.shareProgressLevel = shareProgressLevel;
} }
public boolean canRequireSameQuest() { public boolean canShareOnlySameQuest() {
return requireSameQuest; return shareOnlySameQuest;
} }
public void setRequireSameQuest(final boolean requireSameQuest) { public void setShareOnlySameQuest(final boolean shareOnlySameQuest) {
this.requireSameQuest = requireSameQuest; this.shareOnlySameQuest = shareOnlySameQuest;
} }
} }

View File

@ -17,6 +17,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.alessiodp.parties.api.interfaces.Party;
import com.alessiodp.parties.api.interfaces.PartyPlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -494,8 +496,18 @@ public class Quest implements Comparable<Quest> {
* *
* @param q The quester finishing this quest * @param q The quester finishing this quest
*/ */
@SuppressWarnings("deprecation")
public void completeQuest(final Quester q) { public void completeQuest(final Quester q) {
completeQuest(q, true);
}
/**
* Proceed to finish this quest, issuing applicable rewards
*
* @param q The quester finishing this quest
* @param allowMultiplayer Allow multiplayer sharing
*/
@SuppressWarnings("deprecation")
public void completeQuest(final Quester q, boolean allowMultiplayer) {
final OfflinePlayer player = q.getOfflinePlayer(); final OfflinePlayer player = q.getOfflinePlayer();
if (player.isOnline()) { if (player.isOnline()) {
final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this); final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this);
@ -621,6 +633,19 @@ public class Quest implements Comparable<Quest> {
issuedReward = true; issuedReward = true;
} }
} }
if (rews.getPartiesExperience() > 0 && plugin.getDependencies().getPartiesApi() != null) {
PartyPlayer partyPlayer = plugin.getDependencies().getPartiesApi().getPartyPlayer(player.getUniqueId());
if (partyPlayer != null && partyPlayer.getPartyId() != null) {
Party party = plugin.getDependencies().getPartiesApi().getParty(partyPlayer.getPartyId());
if (party != null) {
party.giveExperience(rews.getPartiesExperience());
issuedReward = true;
if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " + rews.getPartiesExperience() + " party experience");
}
}
}
}
final LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>(); final LinkedList<ItemStack> phatLootItems = new LinkedList<ItemStack>();
int phatLootExp = 0; int phatLootExp = 0;
final LinkedList<String> phatLootMessages = new LinkedList<String>(); final LinkedList<String> phatLootMessages = new LinkedList<String>();
@ -676,7 +701,7 @@ public class Quest implements Comparable<Quest> {
if (rews.getQuestPoints() > 0) { if (rews.getQuestPoints() > 0) {
q.questPoints += rews.getQuestPoints(); q.questPoints += rews.getQuestPoints();
if (plugin.getSettings().getConsoleLogging() > 2) { if (plugin.getSettings().getConsoleLogging() > 2) {
plugin.getLogger().info(player.getUniqueId() + " was rewarded " + rews.getQuestPoints() plugin.getLogger().info(player.getUniqueId() + " was rewarded " + rews.getQuestPoints() + " "
+ Lang.get("questPoints")); + Lang.get("questPoints"));
} }
issuedReward = true; issuedReward = true;
@ -863,6 +888,10 @@ public class Quest implements Comparable<Quest> {
+ s + " " + Lang.get(p, "experience")); + s + " " + Lang.get(p, "experience"));
} }
} }
if (rews.getPartiesExperience() > 0) {
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getPartiesExperience() + ChatColor.DARK_PURPLE + " "
+ Lang.get(p, "partiesExperience"));
}
if (phatLootMessages.isEmpty() == false) { if (phatLootMessages.isEmpty() == false) {
for (final String s : phatLootMessages) { for (final String s : phatLootMessages) {
q.sendMessage("- " + s); q.sendMessage("- " + s);
@ -908,11 +937,11 @@ public class Quest implements Comparable<Quest> {
} }
// Multiplayer // Multiplayer
if (opts.getShareProgressLevel() == 4) { if (allowMultiplayer && opts.getShareProgressLevel() == 4) {
final List<Quester> mq = q.getMultiplayerQuesters(this); final List<Quester> mq = q.getMultiplayerQuesters(this);
for (final Quester qq : mq) { for (final Quester qq : mq) {
if (qq.getQuestData(this) != null) { if (qq.getQuestData(this) != null) {
completeQuest(qq); completeQuest(qq, false);
} }
} }
} }

View File

@ -251,6 +251,9 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses()); context.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses());
context.setSessionData(CK.REW_HEROES_AMOUNTS, rews.getHeroesAmounts()); context.setSessionData(CK.REW_HEROES_AMOUNTS, rews.getHeroesAmounts());
} }
if (rews.getPartiesExperience() != 0) {
context.setSessionData(CK.REW_PARTIES_EXPERIENCE, rews.getPhatLoots());
}
if (rews.getPhatLoots().isEmpty() == false) { if (rews.getPhatLoots().isEmpty() == false) {
context.setSessionData(CK.REW_PHAT_LOOTS, rews.getPhatLoots()); context.setSessionData(CK.REW_PHAT_LOOTS, rews.getPhatLoots());
} }
@ -282,7 +285,7 @@ public class QuestFactory implements ConversationAbandonedListener {
context.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.canUseDungeonsXLPlugin()); context.setSessionData(CK.OPT_USE_DUNGEONSXL_PLUGIN, opt.canUseDungeonsXLPlugin());
context.setSessionData(CK.OPT_USE_PARTIES_PLUGIN, opt.canUsePartiesPlugin()); context.setSessionData(CK.OPT_USE_PARTIES_PLUGIN, opt.canUsePartiesPlugin());
context.setSessionData(CK.OPT_SHARE_PROGRESS_LEVEL, opt.getShareProgressLevel()); context.setSessionData(CK.OPT_SHARE_PROGRESS_LEVEL, opt.getShareProgressLevel());
context.setSessionData(CK.OPT_REQUIRE_SAME_QUEST, opt.canRequireSameQuest()); context.setSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST, opt.canShareOnlySameQuest());
// Stages (Objectives) // Stages (Objectives)
int index = 1; int index = 1;
for (final Stage stage : q.getStages()) { for (final Stage stage : q.getStages()) {
@ -892,6 +895,8 @@ public class QuestFactory implements ConversationAbandonedListener {
? (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES) : null); ? (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES) : null);
rews.set("heroes-exp-amounts", context.getSessionData(CK.REW_HEROES_AMOUNTS) != null rews.set("heroes-exp-amounts", context.getSessionData(CK.REW_HEROES_AMOUNTS) != null
? (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS) : null); ? (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS) : null);
rews.set("parties-experience", context.getSessionData(CK.REW_PARTIES_EXPERIENCE) != null
? (Integer) context.getSessionData(CK.REW_PARTIES_EXPERIENCE) : null);
rews.set("phat-loots", context.getSessionData(CK.REW_PHAT_LOOTS) != null rews.set("phat-loots", context.getSessionData(CK.REW_PHAT_LOOTS) != null
? (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS) : null); ? (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS) : null);
final LinkedList<String> customRews = context.getSessionData(CK.REW_CUSTOM) != null final LinkedList<String> customRews = context.getSessionData(CK.REW_CUSTOM) != null
@ -944,8 +949,8 @@ public class QuestFactory implements ConversationAbandonedListener {
? (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) : null); ? (Boolean) context.getSessionData(CK.OPT_USE_PARTIES_PLUGIN) : null);
opts.set("share-progress-level", context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) != null opts.set("share-progress-level", context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) != null
? (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) : null); ? (Integer) context.getSessionData(CK.OPT_SHARE_PROGRESS_LEVEL) : null);
opts.set("require-same-quest", context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) != null opts.set("share-only-same-quest", context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) != null
? (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) : null); ? (Boolean) context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) : null);
if (opts.getKeys(false).isEmpty()) { if (opts.getKeys(false).isEmpty()) {
section.set("options", null); section.set("options", null);
} }

View File

@ -24,9 +24,11 @@ import java.util.Random;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.ConcurrentSkipListSet;
import java.util.function.BiFunction;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alessiodp.parties.api.interfaces.PartyPlayer;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
@ -3008,7 +3010,7 @@ public class Quester implements Comparable<Quester> {
/** /**
* Complete quest objective * Complete quest objective
* *
* @deprecated Use {@link #finishObjective(Quest, ObjectiveType, ItemStack, ItemStack, Enchantment, EntityType, * @deprecated Use {@link #finishObjective(Quest, Objective, EntityType,
* String, NPC, Location, DyeColor, String, CustomObjective)} * String, NPC, Location, DyeColor, String, CustomObjective)}
* *
* @param quest * @param quest
@ -3954,13 +3956,13 @@ public class Quester implements Comparable<Quester> {
* milkCow, catchFish, killMob, deliverItem, killPlayer, talkToNPC, * milkCow, catchFish, killMob, deliverItem, killPlayer, talkToNPC,
* killNPC, tameMob, shearSheep, password, reachLocation * killNPC, tameMob, shearSheep, password, reachLocation
* *
* @deprecated Use {@link #dispatchMultiplayerEverything(Quest, ObjectiveType, Function)} * @deprecated Use {@link #dispatchMultiplayerEverything(Quest, ObjectiveType, BiFunction)}
* *
* @param objectiveType The type of objective to progress * @param objectiveType The type of objective to progress
* @param fun The function to execute, the event call * @param fun The function to execute, the event call
*/ */
@Deprecated @Deprecated
public void dispatchMultiplayerEverything(final Quest quest, final String objectiveType, final Function<Quester, Void> fun) { public void dispatchMultiplayerEverything(final Quest quest, final String objectiveType, final BiFunction<Quester, Quest, Void> fun) {
dispatchMultiplayerEverything(quest, ObjectiveType.fromName(objectiveType), fun); dispatchMultiplayerEverything(quest, ObjectiveType.fromName(objectiveType), fun);
} }
@ -3970,7 +3972,7 @@ public class Quester implements Comparable<Quester> {
* @param type The type of objective to progress * @param type The type of objective to progress
* @param fun The function to execute, the event call * @param fun The function to execute, the event call
*/ */
public void dispatchMultiplayerEverything(final Quest quest, final ObjectiveType type, final Function<Quester, Void> fun) { public void dispatchMultiplayerEverything(final Quest quest, final ObjectiveType type, final BiFunction<Quester, Quest, Void> fun) {
if (quest == null) { if (quest == null) {
return; return;
} }
@ -3982,19 +3984,18 @@ public class Quester implements Comparable<Quester> {
} }
for (final Quester q : mq) { for (final Quester q : mq) {
if (q == null) { if (q == null) {
return; continue;
} }
if (q.getCurrentStage(quest) == null) { if (quest.getOptions().canShareOnlySameQuest()) {
return; if (q.getCurrentStage(quest) != null) {
fun.apply(q, quest);
} }
if (q.getCurrentStage(quest).containsObjective(type)) { } else {
if (this.getCurrentStage(quest) == null) { q.getCurrentQuests().forEach((otherQuest, i) -> {
return; if (otherQuest.getStage(i).containsObjective(type)) {
} fun.apply(q, otherQuest);
if (this.getCurrentStage(quest).containsObjective(type)
|| !quest.getOptions().canRequireSameQuest()) {
fun.apply(q);
} }
});
} }
} }
} }
@ -4024,8 +4025,9 @@ public class Quester implements Comparable<Quester> {
if (q == null) { if (q == null) {
return; return;
} }
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest))) // Share only same quest is not necessary here
|| !quest.getOptions().canRequireSameQuest()) { // The function must be applied to the same quest
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest)))) {
fun.apply(q); fun.apply(q);
} }
} }
@ -4045,18 +4047,37 @@ public class Quester implements Comparable<Quester> {
final List<Quester> mq = new LinkedList<Quester>(); final List<Quester> mq = new LinkedList<Quester>();
if (plugin.getDependencies().getPartiesApi() != null) { if (plugin.getDependencies().getPartiesApi() != null) {
if (quest.getOptions().canUsePartiesPlugin()) { if (quest.getOptions().canUsePartiesPlugin()) {
final Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies() final PartyPlayer partyPlayer = plugin.getDependencies().getPartiesApi().getPartyPlayer(getUUID());
.getPartiesApi().getPartyPlayer(getUUID()).getPartyName()); if (partyPlayer != null && partyPlayer.getPartyId() != null) {
final Party party = plugin.getDependencies().getPartiesApi().getParty(partyPlayer.getPartyId());
if (party != null) { if (party != null) {
long distanceSquared = quest.getOptions().getPartiesDistance() * quest.getOptions().getPartiesDistance();
boolean offlinePlayers = quest.getOptions().canPartiesHandleOfflinePlayers();
if (offlinePlayers) {
for (final UUID id : party.getMembers()) { for (final UUID id : party.getMembers()) {
if (!id.equals(getUUID())) { if (!id.equals(getUUID())) {
mq.add(plugin.getQuester(id)); mq.add(plugin.getQuester(id));
} }
} }
} else {
for (final PartyPlayer pp : party.getOnlineMembers(true)) {
if (!pp.getPlayerUUID().equals(getUUID())) {
if (distanceSquared > 0) {
Player player = Bukkit.getPlayer(pp.getPlayerUUID());
if (player != null && distanceSquared >= getPlayer().getLocation().distanceSquared(player.getLocation())) {
mq.add(plugin.getQuester(pp.getPlayerUUID()));
}
} else
mq.add(plugin.getQuester(pp.getPlayerUUID()));
}
}
}
return mq; return mq;
} }
} }
} }
}
if (plugin.getDependencies().getDungeonsApi() != null) { if (plugin.getDependencies().getDungeonsApi() != null) {
if (quest.getOptions().canUseDungeonsXLPlugin()) { if (quest.getOptions().canUseDungeonsXLPlugin()) {
final DGroup group = (DGroup) plugin.getDependencies().getDungeonsApi().getPlayerGroup(getPlayer()); final DGroup group = (DGroup) plugin.getDependencies().getDungeonsApi().getPlayerGroup(getPlayer());

View File

@ -1876,6 +1876,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
} }
} }
} }
if (depends.isPluginAvailable("Parties")) {
if (config.contains("quests." + questKey + ".rewards.parties-experience")) {
if (config.getInt("quests." + questKey + ".rewards.parties-experience", -999) != -999) {
rews.setPartiesExperience(config.getInt("quests." + questKey + ".rewards.parties-experience"));
} else {
throw new QuestFormatException("Reward Parties experience is not a number", questKey);
}
}
}
if (depends.isPluginAvailable("PhatLoots")) { if (depends.isPluginAvailable("PhatLoots")) {
if (config.contains("quests." + questKey + ".rewards.phat-loots")) { if (config.contains("quests." + questKey + ".rewards.phat-loots")) {
if (ConfigUtil.checkList(config.getList("quests." + questKey + ".rewards.phat-loots"), String.class)) { if (ConfigUtil.checkList(config.getList("quests." + questKey + ".rewards.phat-loots"), String.class)) {
@ -2159,11 +2168,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (config.contains("quests." + questKey + ".options.use-parties-plugin")) { if (config.contains("quests." + questKey + ".options.use-parties-plugin")) {
opts.setUsePartiesPlugin(config.getBoolean("quests." + questKey + ".options.use-parties-plugin")); opts.setUsePartiesPlugin(config.getBoolean("quests." + questKey + ".options.use-parties-plugin"));
} }
if (config.contains("quests." + questKey + ".options.parties.handle-offline-players")) {
opts.setPartiesHandleOfflinePlayers(config.getBoolean("quests." + questKey + ".options.parties.handle-offline-players"));
}
if (config.contains("quests." + questKey + ".options.parties.distance")) {
opts.setPartiesDistance(config.getLong("quests." + questKey + ".options.parties.distance"));
}
if (config.contains("quests." + questKey + ".options.share-progress-level")) { if (config.contains("quests." + questKey + ".options.share-progress-level")) {
opts.setShareProgressLevel(config.getInt("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")) { if (config.contains("quests." + questKey + ".options.share-only-same-quest")) {
opts.setRequireSameQuest(config.getBoolean("quests." + questKey + ".options.require-same-quest")); opts.setShareOnlySameQuest(config.getBoolean("quests." + questKey + ".options.share-only-same-quest"));
} }
} }

View File

@ -32,6 +32,7 @@ public class Rewards {
private List<Integer> mcmmoAmounts = new LinkedList<Integer>(); private List<Integer> mcmmoAmounts = new LinkedList<Integer>();
private List<String> heroesClasses = new LinkedList<String>(); private List<String> heroesClasses = new LinkedList<String>();
private List<Double> heroesAmounts = new LinkedList<Double>(); private List<Double> heroesAmounts = new LinkedList<Double>();
private int partiesExperience = 0;
private List<String> phatLoots = new LinkedList<String>(); private List<String> phatLoots = new LinkedList<String>();
private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>(); private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
private List<String> detailsOverride = new LinkedList<String>(); private List<String> detailsOverride = new LinkedList<String>();
@ -108,6 +109,12 @@ public class Rewards {
public void setHeroesAmounts(final List<Double> heroesAmounts) { public void setHeroesAmounts(final List<Double> heroesAmounts) {
this.heroesAmounts = heroesAmounts; this.heroesAmounts = heroesAmounts;
} }
public int getPartiesExperience() {
return partiesExperience;
}
public void setPartiesExperience(int partiesExperience) {
this.partiesExperience = partiesExperience;
}
public List<String> getPhatLoots() { public List<String> getPhatLoots() {
return phatLoots; return phatLoots;
} }

View File

@ -458,7 +458,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
case 3: case 3:
return ChatColor.YELLOW + Lang.get("optShareProgressLevel"); return ChatColor.YELLOW + Lang.get("optShareProgressLevel");
case 4: case 4:
return ChatColor.YELLOW + Lang.get("optRequireSameQuest"); return ChatColor.YELLOW + Lang.get("optShareOnlySameQuest");
case 5: case 5:
return ChatColor.YELLOW + Lang.get("done"); return ChatColor.YELLOW + Lang.get("done");
default: default:
@ -502,13 +502,13 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")"; return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
} }
case 4: case 4:
if (context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) == null) { if (context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) == null) {
final boolean defaultOpt = new Options().canRequireSameQuest(); final boolean defaultOpt = new Options().canShareOnlySameQuest();
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED + Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")"; + Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
} else { } else {
final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST); final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST);
return ChatColor.GRAY + "(" + (requireOpt ? ChatColor.GREEN return ChatColor.GRAY + "(" + (requireOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(requireOpt)) : ChatColor.RED + Lang.get(String.valueOf(requireOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")"; + Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")";
@ -549,7 +549,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
tempPrompt = new OptionsMultiplayerPrompt(context); tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsLevelPrompt(context); return new OptionsLevelPrompt(context);
case 4: case 4:
tempKey = CK.OPT_REQUIRE_SAME_QUEST; tempKey = CK.OPT_SHARE_ONLY_SAME_QUEST;
tempPrompt = new OptionsMultiplayerPrompt(context); tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsTrueFalsePrompt(context); return new OptionsTrueFalsePrompt(context);
case 5: case 5:

View File

@ -47,7 +47,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
private final Quests plugin; private final Quests plugin;
private final String classPrefix; private final String classPrefix;
private boolean hasReward = false; private boolean hasReward = false;
private final int size = 12; private final int size = 13;
public RewardsPrompt(final ConversationContext context) { public RewardsPrompt(final ConversationContext context) {
super(context); super(context);
@ -93,14 +93,20 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY; return ChatColor.GRAY;
} }
case 9: case 9:
if (plugin.getDependencies().getPhatLoots() != null) { if (plugin.getDependencies().getPartiesApi() != null) {
return ChatColor.BLUE; return ChatColor.BLUE;
} else { } else {
return ChatColor.GRAY; return ChatColor.GRAY;
} }
case 10: case 10:
if (plugin.getDependencies().getPhatLoots() != null) {
return ChatColor.BLUE; return ChatColor.BLUE;
} else {
return ChatColor.GRAY;
}
case 11: case 11:
return ChatColor.BLUE;
case 12:
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) { if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
if (!hasReward) { if (!hasReward) {
return ChatColor.GRAY; return ChatColor.GRAY;
@ -110,7 +116,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
} else { } else {
return ChatColor.BLUE; return ChatColor.BLUE;
} }
case 12: case 13:
return ChatColor.GREEN; return ChatColor.GREEN;
default: default:
return null; return null;
@ -149,20 +155,26 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + Lang.get("rewSetHeroes"); return ChatColor.GRAY + Lang.get("rewSetHeroes");
} }
case 9: case 9:
if (plugin.getDependencies().getPartiesApi() != null) {
return ChatColor.YELLOW + Lang.get("rewSetPartiesExperience");
} else {
return ChatColor.GRAY + Lang.get("rewSetPartiesExperience");
}
case 10:
if (plugin.getDependencies().getPhatLoots() != null) { if (plugin.getDependencies().getPhatLoots() != null) {
return ChatColor.YELLOW + Lang.get("rewSetPhat"); return ChatColor.YELLOW + Lang.get("rewSetPhat");
} else { } else {
return ChatColor.GRAY + Lang.get("rewSetPhat"); return ChatColor.GRAY + Lang.get("rewSetPhat");
} }
case 10:
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
case 11: case 11:
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
case 12:
if (!hasReward) { if (!hasReward) {
return ChatColor.GRAY + Lang.get("overrideCreateSet"); return ChatColor.GRAY + Lang.get("overrideCreateSet");
} else { } else {
return ChatColor.YELLOW + Lang.get("overrideCreateSet"); return ChatColor.YELLOW + Lang.get("overrideCreateSet");
} }
case 12: case 13:
return ChatColor.YELLOW + Lang.get("done"); return ChatColor.YELLOW + Lang.get("done");
default: default:
return null; return null;
@ -296,6 +308,13 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")"; return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
} }
case 9: case 9:
if (context.getSessionData(CK.REW_PARTIES_EXPERIENCE) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else {
return ChatColor.GRAY + "(" + ChatColor.AQUA + context.getSessionData(CK.REW_PARTIES_EXPERIENCE) + " "
+ Lang.get("points") + ChatColor.DARK_GRAY + ")";
}
case 10:
if (plugin.getDependencies().getPhatLoots() != null) { if (plugin.getDependencies().getPhatLoots() != null) {
if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) { if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
@ -310,7 +329,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
} else { } else {
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")"; return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
} }
case 10: case 11:
if (context.getSessionData(CK.REW_CUSTOM) == null) { if (context.getSessionData(CK.REW_CUSTOM) == null) {
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")"; return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
} else { } else {
@ -322,7 +341,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
} }
return text; return text;
} }
case 11: case 12:
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) { if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
if (!hasReward) { if (!hasReward) {
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")"; return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
@ -338,7 +357,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
} }
return text; return text;
} }
case 12: case 13:
return ""; return "";
default: default:
return null; return null;
@ -409,14 +428,16 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
return new RewardsPrompt(context); return new RewardsPrompt(context);
} }
case 9: case 9:
return new RewardsPartiesExperiencePrompt(context);
case 10:
if (plugin.getDependencies().getPhatLoots() != null) { if (plugin.getDependencies().getPhatLoots() != null) {
return new RewardsPhatLootsPrompt(context); return new RewardsPhatLootsPrompt(context);
} else { } else {
return new RewardsPrompt(context); return new RewardsPrompt(context);
} }
case 10:
return new CustomRewardsPrompt(context);
case 11: case 11:
return new CustomRewardsPrompt(context);
case 12:
if (hasReward) { if (hasReward) {
return new OverridePrompt.Builder() return new OverridePrompt.Builder()
.source(this) .source(this)
@ -426,7 +447,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption")); context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
return new RewardsPrompt(context); return new RewardsPrompt(context);
} }
case 12: case 13:
return plugin.getQuestFactory().returnToMenu(context); return plugin.getQuestFactory().returnToMenu(context);
default: default:
return new RewardsPrompt(context); return new RewardsPrompt(context);
@ -442,6 +463,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|| context.getSessionData(CK.REW_PERMISSION) != null || context.getSessionData(CK.REW_PERMISSION) != null
|| context.getSessionData(CK.REW_MCMMO_SKILLS) != null || context.getSessionData(CK.REW_MCMMO_SKILLS) != null
|| context.getSessionData(CK.REW_HEROES_CLASSES) != null || context.getSessionData(CK.REW_HEROES_CLASSES) != null
|| context.getSessionData(CK.REW_PARTIES_EXPERIENCE) != null
|| context.getSessionData(CK.REW_PHAT_LOOTS) != null || context.getSessionData(CK.REW_PHAT_LOOTS) != null
|| context.getSessionData(CK.REW_CUSTOM) != null) { || context.getSessionData(CK.REW_CUSTOM) != null) {
hasReward = true; hasReward = true;
@ -1485,6 +1507,55 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
} }
} }
public class RewardsPartiesExperiencePrompt extends QuestsEditorStringPrompt {
public RewardsPartiesExperiencePrompt(final ConversationContext context) {
super(context);
}
@Override
public String getTitle(final ConversationContext context) {
return null;
}
@Override
public String getQueryText(final ConversationContext context) {
return Lang.get("rewPartiesExperiencePrompt");
}
@Override
public String getPromptText(final ConversationContext context) {
final QuestsEditorPostOpenStringPromptEvent event = new QuestsEditorPostOpenStringPromptEvent(context, this);
context.getPlugin().getServer().getPluginManager().callEvent(event);
return ChatColor.YELLOW + getQueryText(context);
}
@Override
public Prompt acceptInput(final ConversationContext context, final String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false
&& input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
try {
final int i = Integer.parseInt(input);
if (i > 0) {
context.setSessionData(CK.REW_PARTIES_EXPERIENCE, i);
} else {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("inputPosNum"));
return new RewardsPartiesExperiencePrompt(context);
}
} catch (final NumberFormatException e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
return new RewardsPartiesExperiencePrompt(context);
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_PARTIES_EXPERIENCE, null);
return new RewardsPrompt(context);
}
return new RewardsPrompt(context);
}
}
public class RewardsPhatLootsPrompt extends QuestsEditorStringPrompt { public class RewardsPhatLootsPrompt extends QuestsEditorStringPrompt {
public RewardsPhatLootsPrompt(final ConversationContext context) { public RewardsPhatLootsPrompt(final ConversationContext context) {

View File

@ -71,12 +71,14 @@ public class BlockListener implements Listener {
} else { } else {
quester.breakBlock(quest, blockItemStack); quester.breakBlock(quest, blockItemStack);
quester.dispatchMultiplayerEverything(quest, breakType, (final Quester q) -> { // Multiplayer
q.breakBlock(quest, blockItemStack); quester.dispatchMultiplayerEverything(quest, breakType, (final Quester q, final Quest cq) -> {
q.breakBlock(cq, blockItemStack);
return null; return null;
}); });
} }
} }
if (quester.getCurrentQuests().containsKey(quest) if (quester.getCurrentQuests().containsKey(quest)
&& quester.getCurrentStage(quest).containsObjective(placeType)) { && quester.getCurrentStage(quest).containsObjective(placeType)) {
for (final ItemStack is : quester.getQuestData(quest).blocksPlaced) { for (final ItemStack is : quester.getQuestData(quest).blocksPlaced) {
@ -106,11 +108,11 @@ public class BlockListener implements Listener {
} }
} }
} }
quester.dispatchMultiplayerEverything(quest, placeType, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, placeType, (final Quester q, final Quest cq) -> {
for (final ItemStack is : q.getQuestData(quest).blocksPlaced) { for (final ItemStack is : q.getQuestData(cq).blocksPlaced) {
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) { if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
ItemStack toPlace = new ItemStack(is.getType(), 64); ItemStack toPlace = new ItemStack(is.getType(), 64);
for (final ItemStack stack : q.getCurrentStage(quest).getBlocksToPlace()) { for (final ItemStack stack : quester.getCurrentStage(cq).getBlocksToPlace()) {
if (ItemUtil.compareItems(is, stack, true) == 0) { if (ItemUtil.compareItems(is, stack, true) == 0) {
toPlace = stack; toPlace = stack;
} }
@ -118,17 +120,17 @@ public class BlockListener implements Listener {
final ObjectiveType type = ObjectiveType.PLACE_BLOCK; final ObjectiveType type = ObjectiveType.PLACE_BLOCK;
final QuesterPreUpdateObjectiveEvent preEvent final QuesterPreUpdateObjectiveEvent preEvent
= new QuesterPreUpdateObjectiveEvent(q, quest, = new QuesterPreUpdateObjectiveEvent(q, cq,
new Objective(type, is.getAmount(), toPlace.getAmount())); new Objective(type, is.getAmount(), toPlace.getAmount()));
plugin.getServer().getPluginManager().callEvent(preEvent); plugin.getServer().getPluginManager().callEvent(preEvent);
final int index = q.getQuestData(quest).blocksPlaced.indexOf(is); final int index = q.getQuestData(cq).blocksPlaced.indexOf(is);
final int newAmount = is.getAmount() - 1; final int newAmount = is.getAmount() - 1;
is.setAmount(newAmount); is.setAmount(newAmount);
q.getQuestData(quest).blocksPlaced.set(index, is); q.getQuestData(cq).blocksPlaced.set(index, is);
final QuesterPostUpdateObjectiveEvent postEvent final QuesterPostUpdateObjectiveEvent postEvent
= new QuesterPostUpdateObjectiveEvent(q, quest, = new QuesterPostUpdateObjectiveEvent(q, cq,
new Objective(type, newAmount, toPlace.getAmount())); new Objective(type, newAmount, toPlace.getAmount()));
plugin.getServer().getPluginManager().callEvent(postEvent); plugin.getServer().getPluginManager().callEvent(postEvent);
} }
@ -141,9 +143,9 @@ public class BlockListener implements Listener {
quester.cutBlock(quest, blockItemStack); quester.cutBlock(quest, blockItemStack);
} }
} }
quester.dispatchMultiplayerEverything(quest, cutType, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, cutType, (final Quester q, final Quest cq) -> {
if (player.getItemInHand().getType().equals(Material.SHEARS)) { if (player.getItemInHand().getType().equals(Material.SHEARS)) {
q.cutBlock(quest, blockItemStack); q.cutBlock(cq, blockItemStack);
} }
return null; return null;
}); });
@ -171,8 +173,8 @@ public class BlockListener implements Listener {
quester.damageBlock(quest, blockItemStack); quester.damageBlock(quest, blockItemStack);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.placeBlock(quest, blockItemStack); q.placeBlock(cq, blockItemStack);
return null; return null;
}); });
} }
@ -199,8 +201,8 @@ public class BlockListener implements Listener {
quester.placeBlock(quest, blockItemStack); quester.placeBlock(quest, blockItemStack);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.placeBlock(quest, blockItemStack); q.placeBlock(cq, blockItemStack);
return null; return null;
}); });
} }
@ -239,8 +241,8 @@ public class BlockListener implements Listener {
quester.useBlock(quest, blockItemStack); quester.useBlock(quest, blockItemStack);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.useBlock(quest, blockItemStack); q.useBlock(cq, blockItemStack);
return null; return null;
}); });
} }

View File

@ -56,8 +56,8 @@ public class ItemListener implements Listener {
quester.craftItem(quest, craftedItem); quester.craftItem(quest, craftedItem);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.craftItem(quest, craftedItem); q.craftItem(cq, craftedItem);
return null; return null;
}); });
} }
@ -101,8 +101,8 @@ public class ItemListener implements Listener {
quester.smeltItem(quest, evt.getCurrentItem()); quester.smeltItem(quest, evt.getCurrentItem());
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.smeltItem(quest, evt.getCurrentItem()); q.smeltItem(cq, evt.getCurrentItem());
return null; return null;
}); });
} }
@ -121,8 +121,8 @@ public class ItemListener implements Listener {
quester.brewItem(quest, evt.getCurrentItem()); quester.brewItem(quest, evt.getCurrentItem());
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.brewItem(quest, evt.getCurrentItem()); q.brewItem(cq, evt.getCurrentItem());
return null; return null;
}); });
} }
@ -153,8 +153,8 @@ public class ItemListener implements Listener {
quester.enchantItem(quest, enchantedItem); quester.enchantItem(quest, enchantedItem);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.enchantItem(quest, enchantedItem); q.enchantItem(cq, enchantedItem);
return null; return null;
}); });
} }
@ -179,8 +179,8 @@ public class ItemListener implements Listener {
quester.consumeItem(quest, consumedItem); quester.consumeItem(quest, consumedItem);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.consumeItem(quest, consumedItem); q.consumeItem(cq, consumedItem);
return null; return null;
}); });
} }

View File

@ -19,7 +19,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostCreateEvent; import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostCreateEvent;
import com.alessiodp.parties.api.events.bukkit.party.BukkitPartiesPartyPostDeleteEvent;
import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent; import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostJoinEvent;
import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent; import com.alessiodp.parties.api.events.bukkit.player.BukkitPartiesPlayerPostLeaveEvent;
@ -39,51 +38,21 @@ public class PartiesListener implements Listener {
} }
} }
@EventHandler
public void onPartyDeleteEvent(final BukkitPartiesPartyPostDeleteEvent event) {
if (event.getCommandSender() != null) {
final Player p = Bukkit.getServer().getPlayer(event.getCommandSender().getPlayerUUID());
if (p != null) {
if (Lang.get("questPartiesDelete").length() > 0) {
p.sendMessage(ChatColor.RED + Lang.get("questPartiesDelete"));
}
}
}
}
@EventHandler @EventHandler
public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) { public void onPlayerJoinEvent(final BukkitPartiesPlayerPostJoinEvent event) {
if (event.isInvited() && event.getInviter() != null) {
final Player i = Bukkit.getServer().getPlayer(event.getInviter());
if (i != null) {
if (Lang.get("questPartiesInvite").length() > 0) {
i.sendMessage(ChatColor.GREEN + Lang.get(i, "questPartiesInvite").replace("<player>", i.getName()));
}
}
}
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()); final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null) { if (p != null && Lang.get("questPartiesLeave").length() > 0) {
if (Lang.get("questPartiesJoin").length() > 0) { p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin"));
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName())); event.getParty().broadcastMessage(ChatColor.GREEN + Lang.get("questPartiesJoinBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
}
} }
} }
@EventHandler @EventHandler
public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) { public void onPlayerLeaveEvent(final BukkitPartiesPlayerPostLeaveEvent event) {
if (event.isKicked() && event.getKicker() != null) {
final Player k = Bukkit.getServer().getPlayer(event.getKicker().getPlayerUUID());
if (k != null) {
if (Lang.get("questPartiesKicked").length() > 0) {
k.sendMessage(ChatColor.RED + Lang.get(k, "questPartiesKicked").replace("<player>", k.getName()));
}
}
}
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID()); final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null) { if (p != null && Lang.get("questPartiesLeave").length() > 0) {
if (Lang.get("questPartiesLeave").length() > 0) { p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave"));
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName())); event.getParty().broadcastMessage(ChatColor.RED + Lang.get("questPartiesLeaveBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
}
} }
} }
} }

View File

@ -404,8 +404,8 @@ public class PlayerListener implements Listener {
quester.milkCow(quest); quester.milkCow(quest);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.milkCow(quest); q.milkCow(cq);
return null; return null;
}); });
} }
@ -452,8 +452,8 @@ public class PlayerListener implements Listener {
quester.sayPassword(quest, evt); quester.sayPassword(quest, evt);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.sayPassword(quest, evt); q.sayPassword(cq, evt);
return null; return null;
}); });
} }
@ -519,8 +519,8 @@ public class PlayerListener implements Listener {
quester.shearSheep(quest, sheep.getColor()); quester.shearSheep(quest, sheep.getColor());
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.shearSheep(quest, sheep.getColor()); q.shearSheep(cq, sheep.getColor());
return null; return null;
}); });
} }
@ -545,8 +545,8 @@ public class PlayerListener implements Listener {
quester.tameMob(quest, evt.getEntityType()); quester.tameMob(quest, evt.getEntityType());
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.tameMob(quest, evt.getEntityType()); q.tameMob(cq, evt.getEntityType());
return null; return null;
}); });
} }
@ -612,8 +612,8 @@ public class PlayerListener implements Listener {
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target)); quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target)); q.killNPC(cq, CitizensAPI.getNPCRegistry().getNPC(target));
return null; return null;
}); });
} }
@ -629,8 +629,8 @@ public class PlayerListener implements Listener {
quester.killMob(quest, target.getLocation(), target.getType()); quester.killMob(quest, target.getLocation(), target.getType());
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.killMob(quest, target.getLocation(), target.getType()); q.killMob(cq, target.getLocation(), target.getType());
return null; return null;
}); });
} }
@ -731,8 +731,8 @@ public class PlayerListener implements Listener {
quester.killPlayer(quest, (Player)target); quester.killPlayer(quest, (Player)target);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.killPlayer(quest, (Player)target); q.killPlayer(cq, (Player)target);
return null; return null;
}); });
} }
@ -756,8 +756,8 @@ public class PlayerListener implements Listener {
quester.catchFish(quest); quester.catchFish(quest);
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
q.catchFish(quest); q.catchFish(cq);
return null; return null;
}); });
} }
@ -933,11 +933,11 @@ public class PlayerListener implements Listener {
} }
} }
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> { quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
plugin.getServer().getScheduler().runTask(plugin, new Runnable() { plugin.getServer().getScheduler().runTask(plugin, new Runnable() {
@Override @Override
public void run() { public void run() {
q.reachLocation(quest, location); q.reachLocation(cq, location);
} }
}); });
return null; return null;

View File

@ -129,6 +129,7 @@ public class CK {
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts"; public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
public static final String REW_HEROES_CLASSES = "heroesClassRews"; public static final String REW_HEROES_CLASSES = "heroesClassRews";
public static final String REW_HEROES_AMOUNTS = "heroesAmountRews"; public static final String REW_HEROES_AMOUNTS = "heroesAmountRews";
public static final String REW_PARTIES_EXPERIENCE = "partiesExperienceRews";
public static final String REW_PHAT_LOOTS = "phatLootRews"; public static final String REW_PHAT_LOOTS = "phatLootRews";
public static final String REW_CUSTOM = "customRews"; public static final String REW_CUSTOM = "customRews";
public static final String REW_CUSTOM_DATA = "customRewData"; public static final String REW_CUSTOM_DATA = "customRewData";
@ -148,7 +149,7 @@ public class CK {
public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt"; public static final String OPT_USE_DUNGEONSXL_PLUGIN = "useDungeonsXLPluginOpt";
public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt"; public static final String OPT_USE_PARTIES_PLUGIN = "usePartiesPluginOpt";
public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt"; public static final String OPT_SHARE_PROGRESS_LEVEL = "shareProgressLevelOpt";
public static final String OPT_REQUIRE_SAME_QUEST = "requireSameQuestOpt"; public static final String OPT_SHARE_ONLY_SAME_QUEST = "shareOnlySameQuestOpt";
// Actions // Actions
public static final String E_OLD_EVENT = "oldEvent"; public static final String E_OLD_EVENT = "oldEvent";
public static final String E_NAME = "evtName"; public static final String E_NAME = "evtName";

View File

@ -79,10 +79,10 @@ questDungeonsKicked: "<player> can no longer perform quests with you."
questDungeonsLeave: "You can no longer perform quests with Leader <player>." questDungeonsLeave: "You can no longer perform quests with Leader <player>."
questPartiesCreate: "Players added to this party may perform quests together!" questPartiesCreate: "Players added to this party may perform quests together!"
questPartiesDelete: "The quest party was disbanded." questPartiesDelete: "The quest party was disbanded."
questPartiesInvite: "<player> can now perform quests with you!" questPartiesJoin: "You can now perform quests with the party."
questPartiesJoin: "You can now perform quests with <player>." questPartiesJoinBroadcast: "<player> can now perform quests with the party!"
questPartiesKicked: "<player> can no longer perform quests with you." questPartiesLeave: "You can no longer perform quests with the party."
questPartiesLeave: "You can no longer perform quests with <player>." questPartiesLeaveBroadcast: "<player> can no longer perform quests with you."
questWGSetRegion: "Set region start" questWGSetRegion: "Set region start"
questWGPrompt: "Enter WorldGuard region, <clear>, <cancel>" questWGPrompt: "Enter WorldGuard region, <clear>, <cancel>"
questWGInvalidRegion: "<region> is not a valid WorldGuard region!" questWGInvalidRegion: "<region> is not a valid WorldGuard region!"
@ -490,7 +490,7 @@ optCommandsDenied: "You cannot use commands during <quest>."
optUseDungeonsXLPlugin: "Use DungeonsXL plugin" optUseDungeonsXLPlugin: "Use DungeonsXL plugin"
optUsePartiesPlugin: "Use Parties plugin" optUsePartiesPlugin: "Use Parties plugin"
optShareProgressLevel: "Level of progress sharing" optShareProgressLevel: "Level of progress sharing"
optRequireSameQuest: "Require same quest" optShareOnlySameQuest: "Share only with the same quest"
rewSetMoney: "Set money reward" rewSetMoney: "Set money reward"
rewSetQuestPoints: "Set <points> reward" rewSetQuestPoints: "Set <points> reward"
rewSetItems: "Set item rewards" rewSetItems: "Set item rewards"
@ -504,6 +504,7 @@ rewSetPermissionWorlds: "Set permission worlds"
rewPermissionsCleared: "Permission rewards cleared." rewPermissionsCleared: "Permission rewards cleared."
rewSetMcMMO: "Set mcMMO Classic skill rewards" rewSetMcMMO: "Set mcMMO Classic skill rewards"
rewSetHeroes: "Set Heroes experience rewards" rewSetHeroes: "Set Heroes experience rewards"
rewSetPartiesExperience: "Set Parties experience reward"
rewSetPhat: "Set PhatLoot rewards" rewSetPhat: "Set PhatLoot rewards"
rewSetCustom: "Set custom rewards" rewSetCustom: "Set custom rewards"
rewSetHeroesClasses: "Set classes" rewSetHeroesClasses: "Set classes"
@ -517,6 +518,7 @@ rewQuestPointsPrompt: "Enter amount of <points>, <clear>, <cancel>"
rewMcMMOPrompt: "Enter mcMMO Classic skills (or enter 'All' for all skills), <space>, <cancel>" rewMcMMOPrompt: "Enter mcMMO Classic skills (or enter 'All' for all skills), <space>, <cancel>"
rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>" rewHeroesClassesPrompt: "Enter Heroes classes, <space>, <cancel>"
rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), <space>, <cancel>" rewHeroesExperiencePrompt: "Enter experience amounts (numbers, decimals are allowed), <space>, <cancel>"
rewPartiesExperiencePrompt: "Enter amount of Parties experience, <clear>, <cancel>"
rewPhatLootsPrompt: "Enter PhatLoots, <space>, <clear>, <cancel>" rewPhatLootsPrompt: "Enter PhatLoots, <space>, <clear>, <cancel>"
rewCustomRewardPrompt: "Enter the name of a custom reward to add, <clear>, <cancel>" rewCustomRewardPrompt: "Enter the name of a custom reward to add, <clear>, <cancel>"
rewItemsCleared: "Item rewards cleared." rewItemsCleared: "Item rewards cleared."
@ -794,6 +796,7 @@ to: "to"
blocksWithin: "within <amount> blocks of" blocksWithin: "within <amount> blocks of"
valRequired: "Value required" valRequired: "Value required"
experience: "Experience" experience: "Experience"
partiesExperience: "Parties experience"
timePrompt: "Enter amount of time (in seconds), <clear>, <cancel>" timePrompt: "Enter amount of time (in seconds), <clear>, <cancel>"
timerMessage: "Time left to finish the quest/stage: <time> seconds" timerMessage: "Time left to finish the quest/stage: <time> seconds"
timerStart: "You have <time> seconds to finish this quest/stage" timerStart: "You have <time> seconds to finish this quest/stage"