NEW multiplayer distance and offline player options, by @AlessioDP

This commit is contained in:
PikaMug 2021-01-24 01:22:04 -05:00
parent 30565780a6
commit 5bb088bfbf
45 changed files with 191 additions and 86 deletions

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -18,8 +18,8 @@ public class Options {
private boolean ignoreSilkTouch = true;
private boolean useDungeonsXLPlugin = false;
private boolean usePartiesPlugin = true;
private boolean partiesHandleOfflinePlayers = false;
private long partiesDistance = 0;
private boolean handleOfflinePlayers = false;
private double shareDistance = 0.0D;
private int shareProgressLevel = 1;
private boolean shareSameQuestOnly = true;
@ -63,22 +63,6 @@ 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;
}
@ -94,4 +78,20 @@ public class Options {
public void setShareSameQuestOnly(final boolean shareSameQuestOnly) {
this.shareSameQuestOnly = shareSameQuestOnly;
}
public double getShareDistance() {
return shareDistance;
}
public void setShareDistance(final double shareDistance) {
this.shareDistance = shareDistance;
}
public boolean canHandleOfflinePlayers() {
return handleOfflinePlayers;
}
public void setHandleOfflinePlayers(final boolean handleOfflinePlayers) {
this.handleOfflinePlayers = handleOfflinePlayers;
}
}

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -285,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_SAME_QUEST_ONLY, opt.canShareSameQuestOnly());
context.setSessionData(CK.OPT_SHARE_SAME_QUEST_ONLY, opt.canShareSameQuestOnly());
// Stages (Objectives)
int index = 1;
for (final Stage stage : q.getStages()) {
@ -949,8 +949,12 @@ 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("same-quest-only", context.getSessionData(CK.OPT_SAME_QUEST_ONLY) != null
? (Boolean) context.getSessionData(CK.OPT_SAME_QUEST_ONLY) : null);
opts.set("same-quest-only", context.getSessionData(CK.OPT_SHARE_SAME_QUEST_ONLY) != null
? (Boolean) context.getSessionData(CK.OPT_SHARE_SAME_QUEST_ONLY) : null);
opts.set("share-distance", context.getSessionData(CK.OPT_SHARE_DISTANCE) != null
? (Double) context.getSessionData(CK.OPT_SHARE_DISTANCE) : null);
opts.set("handle-offline-players", context.getSessionData(CK.OPT_HANDLE_OFFLINE_PLAYERS) != null
? (Boolean) context.getSessionData(CK.OPT_HANDLE_OFFLINE_PLAYERS) : null);
if (opts.getKeys(false).isEmpty()) {
section.set("options", null);
}

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -4111,8 +4111,9 @@ public class Quester implements Comparable<Quester> {
if (partyPlayer != null && partyPlayer.getPartyId() != null) {
final Party party = plugin.getDependencies().getPartiesApi().getParty(partyPlayer.getPartyId());
if (party != null) {
final long distanceSquared = quest.getOptions().getPartiesDistance() * quest.getOptions().getPartiesDistance();
final boolean offlinePlayers = quest.getOptions().canPartiesHandleOfflinePlayers();
final double distanceSquared = quest.getOptions().getShareDistance()
* quest.getOptions().getShareDistance();
final boolean offlinePlayers = quest.getOptions().canHandleOfflinePlayers();
if (offlinePlayers) {
for (final UUID id : party.getMembers()) {
if (!id.equals(getUUID())) {
@ -4124,14 +4125,16 @@ public class Quester implements Comparable<Quester> {
if (!pp.getPlayerUUID().equals(getUUID())) {
if (distanceSquared > 0) {
final Player player = Bukkit.getPlayer(pp.getPlayerUUID());
if (player != null && distanceSquared >= getPlayer().getLocation().distanceSquared(player.getLocation())) {
if (player != null && distanceSquared >= getPlayer().getLocation()
.distanceSquared(player.getLocation())) {
mq.add(plugin.getQuester(pp.getPlayerUUID()));
}
} else
} else {
mq.add(plugin.getQuester(pp.getPlayerUUID()));
}
}
}
}
return mq;
}
@ -4142,11 +4145,30 @@ public class Quester implements Comparable<Quester> {
if (quest.getOptions().canUseDungeonsXLPlugin()) {
final DGroup group = (DGroup) plugin.getDependencies().getDungeonsApi().getPlayerGroup(getPlayer());
if (group != null) {
final double distanceSquared = quest.getOptions().getShareDistance()
* quest.getOptions().getShareDistance();
final boolean offlinePlayers = quest.getOptions().canHandleOfflinePlayers();
if (offlinePlayers) {
for (final UUID id : group.getMembers()) {
if (!id.equals(getUUID())) {
mq.add(plugin.getQuester(id));
}
}
} else {
for (final UUID id : group.getMembers()) {
if (!id.equals(getUUID())) {
if (distanceSquared > 0) {
final Player player = Bukkit.getPlayer(id);
if (player != null && distanceSquared >= getPlayer().getLocation()
.distanceSquared(player.getLocation())) {
mq.add(plugin.getQuester(id));
}
} else {
mq.add(plugin.getQuester(id));
}
}
}
}
return mq;
}
}

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -2174,18 +2174,18 @@ 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.same-quest-only")) {
opts.setShareSameQuestOnly(config.getBoolean("quests." + questKey + ".options.same-quest-only"));
}
if (config.contains("quests." + questKey + ".options.share-distance")) {
opts.setShareDistance(config.getDouble("quests." + questKey + ".options.share-distance"));
}
if (config.contains("quests." + questKey + ".options.handle-offline-players")) {
opts.setHandleOfflinePlayers(config.getBoolean("quests." + questKey + ".options.handle-offline-players"));
}
}
@SuppressWarnings({ "unchecked", "unused" })

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -112,7 +112,7 @@ public class Rewards {
public int getPartiesExperience() {
return partiesExperience;
}
public void setPartiesExperience(int partiesExperience) {
public void setPartiesExperience(final int partiesExperience) {
this.partiesExperience = partiesExperience;
}
public List<String> getPhatLoots() {

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
@ -9,7 +9,6 @@
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.actions;
import java.util.HashMap;

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -1,5 +1,5 @@
/*******************************************************************************************************
* Continued by PikaMug (formerly HappyPikachu) with permission from _Blackvein_. All rights reserved.
* Copyright (c) 2014 PikaMug and contributors. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN

View File

@ -273,6 +273,48 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
}
}
public class OptionsDistancePrompt extends QuestsEditorStringPrompt {
public OptionsDistancePrompt(final ConversationContext context) {
super(context);
}
@Override
public String getTitle(final ConversationContext context) {
return null;
}
@Override
public String getQueryText(final ConversationContext context) {
return Lang.get("optDistancePrompt");
}
@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 double d = Double.parseDouble(input);
context.setSessionData(tempKey, d);
} catch (final Exception e) {
context.getForWhom().sendRawMessage(ChatColor.RED + Lang.get("reqNotANumber")
.replace("<input>", input));
}
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(tempKey, null);
return tempPrompt;
}
return tempPrompt;
}
}
public class OptionsGeneralPrompt extends QuestsEditorNumericPrompt {
public OptionsGeneralPrompt(final ConversationContext context) {
super(context);
@ -414,7 +456,7 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
super(context);
}
private final int size = 5;
private final int size = 7;
@Override
public int getSize() {
@ -438,6 +480,10 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
case 4:
return ChatColor.BLUE;
case 5:
return ChatColor.BLUE;
case 6:
return ChatColor.BLUE;
case 7:
return ChatColor.GREEN;
default:
return null;
@ -456,6 +502,10 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
case 4:
return ChatColor.YELLOW + Lang.get("optShareOnlySameQuest");
case 5:
return ChatColor.YELLOW + Lang.get("optShareDistance");
case 6:
return ChatColor.YELLOW + Lang.get("optHandleOfflinePlayer");
case 7:
return ChatColor.YELLOW + Lang.get("done");
default:
return null;
@ -498,18 +548,38 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
}
case 4:
if (context.getSessionData(CK.OPT_SAME_QUEST_ONLY) == null) {
if (context.getSessionData(CK.OPT_SHARE_SAME_QUEST_ONLY) == null) {
final boolean defaultOpt = new Options().canShareSameQuestOnly();
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_SAME_QUEST_ONLY);
final boolean requireOpt = (Boolean) context.getSessionData(CK.OPT_SHARE_SAME_QUEST_ONLY);
return ChatColor.GRAY + "(" + (requireOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(requireOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(requireOpt))) + ChatColor.GRAY + ")";
}
case 5:
if (context.getSessionData(CK.OPT_SHARE_DISTANCE) == null) {
final double defaultOpt = new Options().getShareDistance();
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(defaultOpt) + ChatColor.GRAY + ")";
} else {
final double shareOpt = (Double) context.getSessionData(CK.OPT_SHARE_DISTANCE);
return ChatColor.GRAY + "(" + ChatColor.AQUA + String.valueOf(shareOpt) + ChatColor.GRAY + ")";
}
case 6:
if (context.getSessionData(CK.OPT_HANDLE_OFFLINE_PLAYERS) == null) {
final boolean defaultOpt = new Options().canHandleOfflinePlayers();
return ChatColor.GRAY + "("+ (defaultOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(defaultOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(defaultOpt))) + ChatColor.GRAY + ")";
} else {
final boolean handleOpt = (Boolean) context.getSessionData(CK.OPT_HANDLE_OFFLINE_PLAYERS);
return ChatColor.GRAY + "(" + (handleOpt ? ChatColor.GREEN
+ Lang.get(String.valueOf(handleOpt)) : ChatColor.RED
+ Lang.get(String.valueOf(handleOpt))) + ChatColor.GRAY + ")";
}
case 7:
return "";
default:
return null;
@ -545,10 +615,18 @@ public class OptionsPrompt extends QuestsEditorNumericPrompt {
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsLevelPrompt(context);
case 4:
tempKey = CK.OPT_SAME_QUEST_ONLY;
tempKey = CK.OPT_SHARE_SAME_QUEST_ONLY;
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsTrueFalsePrompt(context);
case 5:
tempKey = CK.OPT_SHARE_DISTANCE;
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsDistancePrompt(context);
case 6:
tempKey = CK.OPT_HANDLE_OFFLINE_PLAYERS;
tempPrompt = new OptionsMultiplayerPrompt(context);
return new OptionsTrueFalsePrompt(context);
case 7:
tempKey = null;
tempPrompt = null;
try {

View File

@ -69,9 +69,6 @@ public class CK {
public static final String S_SMELT_ITEMS = "smeltItems";
public static final String S_CONSUME_ITEMS = "consumeItems";
public static final String S_ENCHANT_ITEMS = "enchantItems";
//public static final String S_ENCHANT_TYPES = "enchantTypes";
//public static final String S_ENCHANT_NAMES = "enchantNames";
//public static final String S_ENCHANT_AMOUNTS = "enchantAmounts";
public static final String S_BREW_ITEMS = "brewItems";
public static final String S_DELIVERY_ITEMS = "deliveryItems";
public static final String S_DELIVERY_NPCS = "deliveryNPCs";
@ -149,7 +146,9 @@ 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_SAME_QUEST_ONLY = "sameQuestOnlyOpt";
public static final String OPT_SHARE_SAME_QUEST_ONLY = "shareSameQuestOnlyOpt";
public static final String OPT_SHARE_DISTANCE = "shareDistance";
public static final String OPT_HANDLE_OFFLINE_PLAYERS = "handleOfflinePlayers";
// Actions
public static final String E_OLD_EVENT = "oldEvent";
public static final String E_NAME = "evtName";

View File

@ -488,6 +488,7 @@ optBooleanQuery: "Select '<true>' or '<false>'"
optBooleanPrompt: "Enter '<true>' or '<false>', <clear>, <cancel>"
optNumberQuery: "Pick level of progress sharing"
optNumberPrompt: "Enter a level (number) for tracking progress, <clear>, <cancel>"
optDistancePrompt: "Enter a distance (number) for share radius, <clear>, <cancel>"
optAllowCommands: "Allow commands during quest"
optAllowQuitting: "Allow quitting during quest"
optIgnoreSilkTouch: "Ignore blocks broken with Silk Touch"
@ -496,6 +497,8 @@ optUseDungeonsXLPlugin: "Use DungeonsXL plugin"
optUsePartiesPlugin: "Use Parties plugin"
optShareProgressLevel: "Level of progress sharing"
optShareOnlySameQuest: "Share with the same quest only"
optShareDistance: "Maximum radial distance"
optHandleOfflinePlayer: "Include offline players"
rewSetMoney: "Set money reward"
rewSetQuestPoints: "Set <points> reward"
rewSetItems: "Set item rewards"