mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-09 18:08:20 +01:00
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:
parent
5d29779bc8
commit
733aa326da
12
main/pom.xml
12
main/pom.xml
@ -18,11 +18,6 @@
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- Parties -->
|
||||
<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>
|
||||
@ -35,6 +30,11 @@
|
||||
<id>sk89q-repo</id>
|
||||
<url>http://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<!-- Parties -->
|
||||
<id>alessiodp-repo</id>
|
||||
<url>https://repo.alessiodp.com/releases/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>placeholderapi</id>
|
||||
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
|
||||
@ -119,7 +119,7 @@
|
||||
<dependency>
|
||||
<groupId>com.alessiodp.parties</groupId>
|
||||
<artifactId>parties-api</artifactId>
|
||||
<version>2.6.3</version>
|
||||
<version>3.0.0-rc.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -18,8 +18,10 @@ public class Options {
|
||||
private boolean ignoreSilkTouch = true;
|
||||
private boolean useDungeonsXLPlugin = false;
|
||||
private boolean usePartiesPlugin = true;
|
||||
private boolean partiesHandleOfflinePlayers = false;
|
||||
private long partiesDistance = 0;
|
||||
private int shareProgressLevel = 1;
|
||||
private boolean requireSameQuest = true;
|
||||
private boolean shareOnlySameQuest = true;
|
||||
|
||||
public boolean canAllowCommands() {
|
||||
return allowCommands;
|
||||
@ -61,6 +63,22 @@ public class Options {
|
||||
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() {
|
||||
return shareProgressLevel;
|
||||
}
|
||||
@ -69,11 +87,11 @@ public class Options {
|
||||
this.shareProgressLevel = shareProgressLevel;
|
||||
}
|
||||
|
||||
public boolean canRequireSameQuest() {
|
||||
return requireSameQuest;
|
||||
public boolean canShareOnlySameQuest() {
|
||||
return shareOnlySameQuest;
|
||||
}
|
||||
|
||||
public void setRequireSameQuest(final boolean requireSameQuest) {
|
||||
this.requireSameQuest = requireSameQuest;
|
||||
public void setShareOnlySameQuest(final boolean shareOnlySameQuest) {
|
||||
this.shareOnlySameQuest = shareOnlySameQuest;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
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.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -494,8 +496,18 @@ public class Quest implements Comparable<Quest> {
|
||||
*
|
||||
* @param q The quester finishing this quest
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
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();
|
||||
if (player.isOnline()) {
|
||||
final QuesterPreCompleteQuestEvent preEvent = new QuesterPreCompleteQuestEvent(q, this);
|
||||
@ -621,6 +633,19 @@ public class Quest implements Comparable<Quest> {
|
||||
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>();
|
||||
int phatLootExp = 0;
|
||||
final LinkedList<String> phatLootMessages = new LinkedList<String>();
|
||||
@ -676,7 +701,7 @@ public class Quest implements Comparable<Quest> {
|
||||
if (rews.getQuestPoints() > 0) {
|
||||
q.questPoints += rews.getQuestPoints();
|
||||
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"));
|
||||
}
|
||||
issuedReward = true;
|
||||
@ -863,6 +888,10 @@ public class Quest implements Comparable<Quest> {
|
||||
+ 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) {
|
||||
for (final String s : phatLootMessages) {
|
||||
q.sendMessage("- " + s);
|
||||
@ -908,11 +937,11 @@ public class Quest implements Comparable<Quest> {
|
||||
}
|
||||
|
||||
// Multiplayer
|
||||
if (opts.getShareProgressLevel() == 4) {
|
||||
if (allowMultiplayer && opts.getShareProgressLevel() == 4) {
|
||||
final List<Quester> mq = q.getMultiplayerQuesters(this);
|
||||
for (final Quester qq : mq) {
|
||||
if (qq.getQuestData(this) != null) {
|
||||
completeQuest(qq);
|
||||
completeQuest(qq, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,6 +251,9 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
context.setSessionData(CK.REW_HEROES_CLASSES, rews.getHeroesClasses());
|
||||
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) {
|
||||
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_PARTIES_PLUGIN, opt.canUsePartiesPlugin());
|
||||
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)
|
||||
int index = 1;
|
||||
for (final Stage stage : q.getStages()) {
|
||||
@ -892,6 +895,8 @@ public class QuestFactory implements ConversationAbandonedListener {
|
||||
? (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES) : null);
|
||||
rews.set("heroes-exp-amounts", 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
|
||||
? (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS) : 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);
|
||||
opts.set("share-progress-level", 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
|
||||
? (Boolean) 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_SHARE_ONLY_SAME_QUEST) : null);
|
||||
if (opts.getKeys(false).isEmpty()) {
|
||||
section.set("options", null);
|
||||
}
|
||||
|
@ -24,9 +24,11 @@ import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListSet;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alessiodp.parties.api.interfaces.PartyPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -3008,7 +3010,7 @@ public class Quester implements Comparable<Quester> {
|
||||
/**
|
||||
* 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)}
|
||||
*
|
||||
* @param quest
|
||||
@ -3954,13 +3956,13 @@ public class Quester implements Comparable<Quester> {
|
||||
* milkCow, catchFish, killMob, deliverItem, killPlayer, talkToNPC,
|
||||
* 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 fun The function to execute, the event call
|
||||
*/
|
||||
@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);
|
||||
}
|
||||
|
||||
@ -3970,7 +3972,7 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param type The type of objective to progress
|
||||
* @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) {
|
||||
return;
|
||||
}
|
||||
@ -3982,19 +3984,18 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
for (final Quester q : mq) {
|
||||
if (q == null) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
if (q.getCurrentStage(quest) == null) {
|
||||
return;
|
||||
if (quest.getOptions().canShareOnlySameQuest()) {
|
||||
if (q.getCurrentStage(quest) != null) {
|
||||
fun.apply(q, quest);
|
||||
}
|
||||
if (q.getCurrentStage(quest).containsObjective(type)) {
|
||||
if (this.getCurrentStage(quest) == null) {
|
||||
return;
|
||||
}
|
||||
if (this.getCurrentStage(quest).containsObjective(type)
|
||||
|| !quest.getOptions().canRequireSameQuest()) {
|
||||
fun.apply(q);
|
||||
} else {
|
||||
q.getCurrentQuests().forEach((otherQuest, i) -> {
|
||||
if (otherQuest.getStage(i).containsObjective(type)) {
|
||||
fun.apply(q, otherQuest);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4024,8 +4025,9 @@ public class Quester implements Comparable<Quester> {
|
||||
if (q == null) {
|
||||
return;
|
||||
}
|
||||
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest)))
|
||||
|| !quest.getOptions().canRequireSameQuest()) {
|
||||
// Share only same quest is not necessary here
|
||||
// The function must be applied to the same quest
|
||||
if ((q.getCurrentQuests().containsKey(quest) && currentStage.equals(q.getCurrentStage(quest)))) {
|
||||
fun.apply(q);
|
||||
}
|
||||
}
|
||||
@ -4045,18 +4047,37 @@ public class Quester implements Comparable<Quester> {
|
||||
final List<Quester> mq = new LinkedList<Quester>();
|
||||
if (plugin.getDependencies().getPartiesApi() != null) {
|
||||
if (quest.getOptions().canUsePartiesPlugin()) {
|
||||
final Party party = plugin.getDependencies().getPartiesApi().getParty(plugin.getDependencies()
|
||||
.getPartiesApi().getPartyPlayer(getUUID()).getPartyName());
|
||||
final PartyPlayer partyPlayer = plugin.getDependencies().getPartiesApi().getPartyPlayer(getUUID());
|
||||
if (partyPlayer != null && partyPlayer.getPartyId() != null) {
|
||||
final Party party = plugin.getDependencies().getPartiesApi().getParty(partyPlayer.getPartyId());
|
||||
if (party != null) {
|
||||
long distanceSquared = quest.getOptions().getPartiesDistance() * quest.getOptions().getPartiesDistance();
|
||||
boolean offlinePlayers = quest.getOptions().canPartiesHandleOfflinePlayers();
|
||||
if (offlinePlayers) {
|
||||
for (final UUID id : party.getMembers()) {
|
||||
if (!id.equals(getUUID())) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plugin.getDependencies().getDungeonsApi() != null) {
|
||||
if (quest.getOptions().canUseDungeonsXLPlugin()) {
|
||||
final DGroup group = (DGroup) plugin.getDependencies().getDungeonsApi().getPlayerGroup(getPlayer());
|
||||
|
@ -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 (config.contains("quests." + questKey + ".rewards.phat-loots")) {
|
||||
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")) {
|
||||
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")) {
|
||||
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"));
|
||||
if (config.contains("quests." + questKey + ".options.share-only-same-quest")) {
|
||||
opts.setShareOnlySameQuest(config.getBoolean("quests." + questKey + ".options.share-only-same-quest"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class Rewards {
|
||||
private List<Integer> mcmmoAmounts = new LinkedList<Integer>();
|
||||
private List<String> heroesClasses = new LinkedList<String>();
|
||||
private List<Double> heroesAmounts = new LinkedList<Double>();
|
||||
private int partiesExperience = 0;
|
||||
private List<String> phatLoots = new LinkedList<String>();
|
||||
private Map<String, Map<String, Object>> customRewards = new HashMap<String, Map<String, Object>>();
|
||||
private List<String> detailsOverride = new LinkedList<String>();
|
||||
@ -108,6 +109,12 @@ public class Rewards {
|
||||
public void setHeroesAmounts(final List<Double> heroesAmounts) {
|
||||
this.heroesAmounts = heroesAmounts;
|
||||
}
|
||||
public int getPartiesExperience() {
|
||||
return partiesExperience;
|
||||
}
|
||||
public void setPartiesExperience(int partiesExperience) {
|
||||
this.partiesExperience = partiesExperience;
|
||||
}
|
||||
public List<String> getPhatLoots() {
|
||||
return phatLoots;
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
case 3:
|
||||
return ChatColor.YELLOW + Lang.get("optShareProgressLevel");
|
||||
case 4:
|
||||
return ChatColor.YELLOW + Lang.get("optRequireSameQuest");
|
||||
return ChatColor.YELLOW + Lang.get("optShareOnlySameQuest");
|
||||
case 5:
|
||||
return ChatColor.YELLOW + Lang.get("done");
|
||||
default:
|
||||
@ -502,13 +502,13 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
|
||||
}
|
||||
case 4:
|
||||
if (context.getSessionData(CK.OPT_REQUIRE_SAME_QUEST) == null) {
|
||||
final boolean defaultOpt = new Options().canRequireSameQuest();
|
||||
if (context.getSessionData(CK.OPT_SHARE_ONLY_SAME_QUEST) == null) {
|
||||
final boolean defaultOpt = new Options().canShareOnlySameQuest();
|
||||
return ChatColor.GRAY + "(" + (defaultOpt ? ChatColor.GREEN
|
||||
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
|
||||
} 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
|
||||
+ Lang.get(String.valueOf(requireOpt)) : ChatColor.RED
|
||||
+ Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")";
|
||||
@ -549,7 +549,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new OptionsLevelPrompt(context);
|
||||
case 4:
|
||||
tempKey = CK.OPT_REQUIRE_SAME_QUEST;
|
||||
tempKey = CK.OPT_SHARE_ONLY_SAME_QUEST;
|
||||
tempPrompt = new OptionsMultiplayerPrompt(context);
|
||||
return new OptionsTrueFalsePrompt(context);
|
||||
case 5:
|
||||
|
@ -47,7 +47,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
private final Quests plugin;
|
||||
private final String classPrefix;
|
||||
private boolean hasReward = false;
|
||||
private final int size = 12;
|
||||
private final int size = 13;
|
||||
|
||||
public RewardsPrompt(final ConversationContext context) {
|
||||
super(context);
|
||||
@ -93,14 +93,20 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 9:
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
if (plugin.getDependencies().getPartiesApi() != null) {
|
||||
return ChatColor.BLUE;
|
||||
} else {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 10:
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
return ChatColor.BLUE;
|
||||
} else {
|
||||
return ChatColor.GRAY;
|
||||
}
|
||||
case 11:
|
||||
return ChatColor.BLUE;
|
||||
case 12:
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY;
|
||||
@ -110,7 +116,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else {
|
||||
return ChatColor.BLUE;
|
||||
}
|
||||
case 12:
|
||||
case 13:
|
||||
return ChatColor.GREEN;
|
||||
default:
|
||||
return null;
|
||||
@ -149,20 +155,26 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + Lang.get("rewSetHeroes");
|
||||
}
|
||||
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) {
|
||||
return ChatColor.YELLOW + Lang.get("rewSetPhat");
|
||||
} else {
|
||||
return ChatColor.GRAY + Lang.get("rewSetPhat");
|
||||
}
|
||||
case 10:
|
||||
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
|
||||
case 11:
|
||||
return ChatColor.DARK_PURPLE + Lang.get("rewSetCustom");
|
||||
case 12:
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY + Lang.get("overrideCreateSet");
|
||||
} else {
|
||||
return ChatColor.YELLOW + Lang.get("overrideCreateSet");
|
||||
}
|
||||
case 12:
|
||||
case 13:
|
||||
return ChatColor.YELLOW + Lang.get("done");
|
||||
default:
|
||||
return null;
|
||||
@ -296,6 +308,13 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
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 (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
@ -310,7 +329,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
} else {
|
||||
return ChatColor.GRAY + "(" + Lang.get("notInstalled") + ")";
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
if (context.getSessionData(CK.REW_CUSTOM) == null) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("noneSet") + ")";
|
||||
} else {
|
||||
@ -322,7 +341,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 11:
|
||||
case 12:
|
||||
if (context.getSessionData(CK.REW_DETAILS_OVERRIDE) == null) {
|
||||
if (!hasReward) {
|
||||
return ChatColor.GRAY + "(" + Lang.get("stageEditorOptional") + ")";
|
||||
@ -338,7 +357,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
case 12:
|
||||
case 13:
|
||||
return "";
|
||||
default:
|
||||
return null;
|
||||
@ -409,14 +428,16 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 9:
|
||||
return new RewardsPartiesExperiencePrompt(context);
|
||||
case 10:
|
||||
if (plugin.getDependencies().getPhatLoots() != null) {
|
||||
return new RewardsPhatLootsPrompt(context);
|
||||
} else {
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 10:
|
||||
return new CustomRewardsPrompt(context);
|
||||
case 11:
|
||||
return new CustomRewardsPrompt(context);
|
||||
case 12:
|
||||
if (hasReward) {
|
||||
return new OverridePrompt.Builder()
|
||||
.source(this)
|
||||
@ -426,7 +447,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("invalidOption"));
|
||||
return new RewardsPrompt(context);
|
||||
}
|
||||
case 12:
|
||||
case 13:
|
||||
return plugin.getQuestFactory().returnToMenu(context);
|
||||
default:
|
||||
return new RewardsPrompt(context);
|
||||
@ -442,6 +463,7 @@ public class RewardsPrompt extends QuestsEditorNumericPrompt {
|
||||
|| context.getSessionData(CK.REW_PERMISSION) != null
|
||||
|| context.getSessionData(CK.REW_MCMMO_SKILLS) != 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_CUSTOM) != null) {
|
||||
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 RewardsPhatLootsPrompt(final ConversationContext context) {
|
||||
|
@ -71,12 +71,14 @@ public class BlockListener implements Listener {
|
||||
} else {
|
||||
quester.breakBlock(quest, blockItemStack);
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, breakType, (final Quester q) -> {
|
||||
q.breakBlock(quest, blockItemStack);
|
||||
// Multiplayer
|
||||
quester.dispatchMultiplayerEverything(quest, breakType, (final Quester q, final Quest cq) -> {
|
||||
q.breakBlock(cq, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (quester.getCurrentQuests().containsKey(quest)
|
||||
&& quester.getCurrentStage(quest).containsObjective(placeType)) {
|
||||
for (final ItemStack is : quester.getQuestData(quest).blocksPlaced) {
|
||||
@ -106,11 +108,11 @@ public class BlockListener implements Listener {
|
||||
}
|
||||
}
|
||||
}
|
||||
quester.dispatchMultiplayerEverything(quest, placeType, (final Quester q) -> {
|
||||
for (final ItemStack is : q.getQuestData(quest).blocksPlaced) {
|
||||
quester.dispatchMultiplayerEverything(quest, placeType, (final Quester q, final Quest cq) -> {
|
||||
for (final ItemStack is : q.getQuestData(cq).blocksPlaced) {
|
||||
if (evt.getBlock().getType().equals(is.getType()) && is.getAmount() > 0) {
|
||||
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) {
|
||||
toPlace = stack;
|
||||
}
|
||||
@ -118,17 +120,17 @@ public class BlockListener implements Listener {
|
||||
|
||||
final ObjectiveType type = ObjectiveType.PLACE_BLOCK;
|
||||
final QuesterPreUpdateObjectiveEvent preEvent
|
||||
= new QuesterPreUpdateObjectiveEvent(q, quest,
|
||||
= new QuesterPreUpdateObjectiveEvent(q, cq,
|
||||
new Objective(type, is.getAmount(), toPlace.getAmount()));
|
||||
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;
|
||||
is.setAmount(newAmount);
|
||||
q.getQuestData(quest).blocksPlaced.set(index, is);
|
||||
q.getQuestData(cq).blocksPlaced.set(index, is);
|
||||
|
||||
final QuesterPostUpdateObjectiveEvent postEvent
|
||||
= new QuesterPostUpdateObjectiveEvent(q, quest,
|
||||
= new QuesterPostUpdateObjectiveEvent(q, cq,
|
||||
new Objective(type, newAmount, toPlace.getAmount()));
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
@ -141,9 +143,9 @@ public class BlockListener implements Listener {
|
||||
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)) {
|
||||
q.cutBlock(quest, blockItemStack);
|
||||
q.cutBlock(cq, blockItemStack);
|
||||
}
|
||||
return null;
|
||||
});
|
||||
@ -171,8 +173,8 @@ public class BlockListener implements Listener {
|
||||
quester.damageBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.placeBlock(cq, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -199,8 +201,8 @@ public class BlockListener implements Listener {
|
||||
quester.placeBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.placeBlock(quest, blockItemStack);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.placeBlock(cq, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -239,8 +241,8 @@ public class BlockListener implements Listener {
|
||||
quester.useBlock(quest, blockItemStack);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.useBlock(quest, blockItemStack);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.useBlock(cq, blockItemStack);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ public class ItemListener implements Listener {
|
||||
quester.craftItem(quest, craftedItem);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.craftItem(quest, craftedItem);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.craftItem(cq, craftedItem);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -101,8 +101,8 @@ public class ItemListener implements Listener {
|
||||
quester.smeltItem(quest, evt.getCurrentItem());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.smeltItem(quest, evt.getCurrentItem());
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.smeltItem(cq, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -121,8 +121,8 @@ public class ItemListener implements Listener {
|
||||
quester.brewItem(quest, evt.getCurrentItem());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.brewItem(quest, evt.getCurrentItem());
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.brewItem(cq, evt.getCurrentItem());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -153,8 +153,8 @@ public class ItemListener implements Listener {
|
||||
quester.enchantItem(quest, enchantedItem);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.enchantItem(quest, enchantedItem);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.enchantItem(cq, enchantedItem);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -179,8 +179,8 @@ public class ItemListener implements Listener {
|
||||
quester.consumeItem(quest, consumedItem);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.consumeItem(quest, consumedItem);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.consumeItem(cq, consumedItem);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
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.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
|
||||
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());
|
||||
if (p != null) {
|
||||
if (Lang.get("questPartiesJoin").length() > 0) {
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin").replace("<player>", p.getName()));
|
||||
}
|
||||
if (p != null && Lang.get("questPartiesLeave").length() > 0) {
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questPartiesJoin"));
|
||||
event.getParty().broadcastMessage(ChatColor.GREEN + Lang.get("questPartiesJoinBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
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());
|
||||
if (p != null) {
|
||||
if (Lang.get("questPartiesLeave").length() > 0) {
|
||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave").replace("<player>", p.getName()));
|
||||
}
|
||||
if (p != null && Lang.get("questPartiesLeave").length() > 0) {
|
||||
p.sendMessage(ChatColor.RED + Lang.get(p, "questPartiesLeave"));
|
||||
event.getParty().broadcastMessage(ChatColor.RED + Lang.get("questPartiesLeaveBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,8 +404,8 @@ public class PlayerListener implements Listener {
|
||||
quester.milkCow(quest);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.milkCow(quest);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.milkCow(cq);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -452,8 +452,8 @@ public class PlayerListener implements Listener {
|
||||
quester.sayPassword(quest, evt);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.sayPassword(quest, evt);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.sayPassword(cq, evt);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -519,8 +519,8 @@ public class PlayerListener implements Listener {
|
||||
quester.shearSheep(quest, sheep.getColor());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.shearSheep(quest, sheep.getColor());
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.shearSheep(cq, sheep.getColor());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -545,8 +545,8 @@ public class PlayerListener implements Listener {
|
||||
quester.tameMob(quest, evt.getEntityType());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.tameMob(quest, evt.getEntityType());
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.tameMob(cq, evt.getEntityType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -612,8 +612,8 @@ public class PlayerListener implements Listener {
|
||||
quester.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.killNPC(quest, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.killNPC(cq, CitizensAPI.getNPCRegistry().getNPC(target));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -629,8 +629,8 @@ public class PlayerListener implements Listener {
|
||||
quester.killMob(quest, target.getLocation(), target.getType());
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.killMob(quest, target.getLocation(), target.getType());
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.killMob(cq, target.getLocation(), target.getType());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -731,8 +731,8 @@ public class PlayerListener implements Listener {
|
||||
quester.killPlayer(quest, (Player)target);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.killPlayer(quest, (Player)target);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.killPlayer(cq, (Player)target);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@ -756,8 +756,8 @@ public class PlayerListener implements Listener {
|
||||
quester.catchFish(quest);
|
||||
}
|
||||
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q) -> {
|
||||
q.catchFish(quest);
|
||||
quester.dispatchMultiplayerEverything(quest, type, (final Quester q, final Quest cq) -> {
|
||||
q.catchFish(cq);
|
||||
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() {
|
||||
@Override
|
||||
public void run() {
|
||||
q.reachLocation(quest, location);
|
||||
q.reachLocation(cq, location);
|
||||
}
|
||||
});
|
||||
return null;
|
||||
|
@ -129,6 +129,7 @@ public class CK {
|
||||
public static final String REW_MCMMO_AMOUNTS = "mcMMOSkillAmounts";
|
||||
public static final String REW_HEROES_CLASSES = "heroesClassRews";
|
||||
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_CUSTOM = "customRews";
|
||||
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_PARTIES_PLUGIN = "usePartiesPluginOpt";
|
||||
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
|
||||
public static final String E_OLD_EVENT = "oldEvent";
|
||||
public static final String E_NAME = "evtName";
|
||||
|
@ -79,10 +79,10 @@ questDungeonsKicked: "<player> can no longer perform quests with you."
|
||||
questDungeonsLeave: "You can no longer perform quests with Leader <player>."
|
||||
questPartiesCreate: "Players added to this party may perform quests together!"
|
||||
questPartiesDelete: "The quest party was disbanded."
|
||||
questPartiesInvite: "<player> can now perform quests with you!"
|
||||
questPartiesJoin: "You can now perform quests with <player>."
|
||||
questPartiesKicked: "<player> can no longer perform quests with you."
|
||||
questPartiesLeave: "You can no longer perform quests with <player>."
|
||||
questPartiesJoin: "You can now perform quests with the party."
|
||||
questPartiesJoinBroadcast: "<player> can now perform quests with the party!"
|
||||
questPartiesLeave: "You can no longer perform quests with the party."
|
||||
questPartiesLeaveBroadcast: "<player> can no longer perform quests with you."
|
||||
questWGSetRegion: "Set region start"
|
||||
questWGPrompt: "Enter WorldGuard region, <clear>, <cancel>"
|
||||
questWGInvalidRegion: "<region> is not a valid WorldGuard region!"
|
||||
@ -490,7 +490,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"
|
||||
optShareOnlySameQuest: "Share only with the same quest"
|
||||
rewSetMoney: "Set money reward"
|
||||
rewSetQuestPoints: "Set <points> reward"
|
||||
rewSetItems: "Set item rewards"
|
||||
@ -504,6 +504,7 @@ rewSetPermissionWorlds: "Set permission worlds"
|
||||
rewPermissionsCleared: "Permission rewards cleared."
|
||||
rewSetMcMMO: "Set mcMMO Classic skill rewards"
|
||||
rewSetHeroes: "Set Heroes experience rewards"
|
||||
rewSetPartiesExperience: "Set Parties experience reward"
|
||||
rewSetPhat: "Set PhatLoot rewards"
|
||||
rewSetCustom: "Set custom rewards"
|
||||
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>"
|
||||
rewHeroesClassesPrompt: "Enter Heroes classes, <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>"
|
||||
rewCustomRewardPrompt: "Enter the name of a custom reward to add, <clear>, <cancel>"
|
||||
rewItemsCleared: "Item rewards cleared."
|
||||
@ -794,6 +796,7 @@ to: "to"
|
||||
blocksWithin: "within <amount> blocks of"
|
||||
valRequired: "Value required"
|
||||
experience: "Experience"
|
||||
partiesExperience: "Parties experience"
|
||||
timePrompt: "Enter amount of time (in seconds), <clear>, <cancel>"
|
||||
timerMessage: "Time left to finish the quest/stage: <time> seconds"
|
||||
timerStart: "You have <time> seconds to finish this quest/stage"
|
||||
|
Loading…
Reference in New Issue
Block a user