mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 02:25:42 +01:00
Translate mob names in Quest Journal. Bump version
This commit is contained in:
parent
77d392dba2
commit
d07a777818
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-api</artifactId>
|
||||
|
||||
|
@ -143,8 +143,6 @@ public interface IQuester extends Comparable<IQuester> {
|
||||
|
||||
LinkedList<String> getCurrentObjectives(final IQuest quest, final boolean ignoreOverrides);
|
||||
|
||||
LinkedList<Objective> getCurrentObjectivesTemp(final IQuest quest, final boolean ignoreOverrides, final boolean formatItems);
|
||||
|
||||
LinkedList<String> getObjectives(final IQuest quest, final boolean ignoreOverrides);
|
||||
|
||||
boolean containsObjective(final IQuest quest, final String name);
|
||||
|
@ -13,7 +13,7 @@
|
||||
package me.blackvein.quests.quests;
|
||||
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface Objective {
|
||||
ObjectiveType getType();
|
||||
@ -24,7 +24,7 @@ public interface Objective {
|
||||
|
||||
int getGoal();
|
||||
|
||||
ItemStack getItemProgress();
|
||||
@NotNull Object getProgressObject();
|
||||
|
||||
ItemStack getItemGoal();
|
||||
@NotNull Object getGoalObject();
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-core</artifactId>
|
||||
|
||||
@ -132,7 +132,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.PikaMug</groupId>
|
||||
<artifactId>LocaleLib</artifactId>
|
||||
<version>5fb19ed10c</version>
|
||||
<version>35b50bfd53</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xyz.upperlevel.spigot.book</groupId>
|
||||
|
@ -20,9 +20,9 @@ import me.blackvein.quests.conditions.ICondition;
|
||||
import me.blackvein.quests.config.ISettings;
|
||||
import me.blackvein.quests.convo.misc.QuestAbandonPrompt;
|
||||
import me.blackvein.quests.dependencies.IDependencies;
|
||||
import me.blackvein.quests.events.quest.QuestQuitEvent;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import me.blackvein.quests.entity.CountableMob;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import me.blackvein.quests.events.quest.QuestQuitEvent;
|
||||
import me.blackvein.quests.events.quest.QuestTakeEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPostStartQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPostUpdateObjectiveEvent;
|
||||
@ -30,6 +30,7 @@ import me.blackvein.quests.events.quester.QuesterPreOpenGUIEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreStartQuestEvent;
|
||||
import me.blackvein.quests.events.quester.QuesterPreUpdateObjectiveEvent;
|
||||
import me.blackvein.quests.item.QuestJournal;
|
||||
import me.blackvein.quests.module.ICustomObjective;
|
||||
import me.blackvein.quests.nms.TitleProvider;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.quests.BukkitObjective;
|
||||
@ -1567,12 +1568,12 @@ public class Quester implements IQuester {
|
||||
*
|
||||
* @param quest The quest to get objectives of
|
||||
* @param ignoreOverrides Whether to ignore objective-overrides
|
||||
* @param formatItems Whether to format item names, if applicable
|
||||
* @param formatNames Whether to format item/entity names, if applicable
|
||||
* @return List of detailed objectives
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public LinkedList<Objective> getCurrentObjectivesTemp(final IQuest quest, final boolean ignoreOverrides,
|
||||
final boolean formatItems) {
|
||||
public LinkedList<BukkitObjective> getCurrentObjectivesTemp(final IQuest quest, final boolean ignoreOverrides,
|
||||
final boolean formatNames) {
|
||||
if (quest == null) {
|
||||
plugin.getLogger().severe("Quest was null when getting objectives for " + getLastKnownName());
|
||||
return new LinkedList<>();
|
||||
@ -1587,7 +1588,7 @@ public class Quester implements IQuester {
|
||||
}
|
||||
final IDependencies depends = plugin.getDependencies();
|
||||
if (!ignoreOverrides && !getCurrentStage(quest).getObjectiveOverrides().isEmpty()) {
|
||||
final LinkedList<Objective> objectives = new LinkedList<>();
|
||||
final LinkedList<BukkitObjective> objectives = new LinkedList<>();
|
||||
for (final String s: getCurrentStage(quest).getObjectiveOverrides()) {
|
||||
String message = ChatColor.GREEN + ConfigUtil.parseString(s, quest, getPlayer());
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
@ -1600,7 +1601,7 @@ public class Quester implements IQuester {
|
||||
}
|
||||
final QuestData data = getQuestData(quest);
|
||||
final IStage stage = getCurrentStage(quest);
|
||||
final LinkedList<Objective> objectives = new LinkedList<>();
|
||||
final LinkedList<BukkitObjective> objectives = new LinkedList<>();
|
||||
for (final ItemStack goal : stage.getBlocksToBreak()) {
|
||||
for (final ItemStack progress : data.blocksBroken) {
|
||||
if (progress.getType().equals(goal.getType()) && progress.getDurability() == goal.getDurability()) {
|
||||
@ -1616,7 +1617,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(progress));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.BREAK_BLOCK, message, progress, goal));
|
||||
@ -1638,7 +1639,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(progress));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.DAMAGE_BLOCK, message, progress, goal));
|
||||
@ -1660,7 +1661,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(progress));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.PLACE_BLOCK, message, progress, goal));
|
||||
@ -1682,7 +1683,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(progress));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.USE_BLOCK, message, progress, goal));
|
||||
@ -1704,7 +1705,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(progress));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.CUT_BLOCK, message, progress, goal));
|
||||
@ -1728,7 +1729,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.CRAFT_ITEM, message, progress, goal));
|
||||
@ -1752,7 +1753,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.SMELT_ITEM, message, progress, goal));
|
||||
@ -1776,7 +1777,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
if (goal.getEnchantments().isEmpty()) {
|
||||
@ -1811,7 +1812,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.BREW_ITEM, message, progress, goal));
|
||||
@ -1835,7 +1836,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.CONSUME_ITEM, message, progress, goal));
|
||||
@ -1860,7 +1861,7 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
if (formatItems) {
|
||||
if (formatNames) {
|
||||
message = message.replace("<item>", ItemUtil.getName(goal));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.DELIVER_ITEM, message, progress, goal));
|
||||
@ -1937,16 +1938,20 @@ public class Quester implements IQuester {
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
|
||||
}
|
||||
message = message.replace("<mob>", MiscUtil.getProperMobName(e));
|
||||
objectives.add(new BukkitObjective(ObjectiveType.KILL_MOB, message, mobKilled, toMobKill));
|
||||
if (formatNames) {
|
||||
message = message.replace("<mob>", MiscUtil.getProperMobName(e));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.KILL_MOB, message,
|
||||
new CountableMob(e, mobKilled), new CountableMob(e, toMobKill)));
|
||||
mobKillIndex++;
|
||||
}
|
||||
int tameIndex = 0;
|
||||
for (final int toTame : stage.getMobNumToTame()) {
|
||||
for (final EntityType e : stage.getMobsToTame()) {
|
||||
int tamed = 0;
|
||||
if (data.mobsTamed.size() > tameIndex) {
|
||||
tamed = data.mobsTamed.get(tameIndex);
|
||||
}
|
||||
final int toTame = stage.getMobNumToTame().get(tameIndex);
|
||||
final ChatColor color = tamed < toTame ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(getPlayer(), "tame");
|
||||
if (!message.contains("<mob>")) {
|
||||
@ -1958,8 +1963,11 @@ public class Quester implements IQuester {
|
||||
// Legacy
|
||||
message += color + ": " + tamed + "/" + toTame;
|
||||
}
|
||||
message = message.replace("<mob>", MiscUtil.getProperMobName(stage.getMobsToTame().get(tameIndex)));
|
||||
objectives.add(new BukkitObjective(ObjectiveType.TAME_MOB, message, tamed, toTame));
|
||||
if (formatNames) {
|
||||
message = message.replace("<mob>", MiscUtil.getProperMobName(stage.getMobsToTame().get(tameIndex)));
|
||||
}
|
||||
objectives.add(new BukkitObjective(ObjectiveType.TAME_MOB, message,
|
||||
new CountableMob(e, tamed), new CountableMob(e, toTame)));
|
||||
tameIndex++;
|
||||
}
|
||||
if (stage.getFishToCatch() != null) {
|
||||
@ -3629,9 +3637,9 @@ public class Quester implements IQuester {
|
||||
}
|
||||
final Player p = getPlayer();
|
||||
final ObjectiveType type = objective.getType();
|
||||
final ItemStack increment = objective.getItemProgress() != null ? objective.getItemProgress()
|
||||
final ItemStack increment = objective.getGoalObject() instanceof ItemStack ? (ItemStack) objective
|
||||
: new ItemStack(Material.AIR, objective.getProgress());
|
||||
final ItemStack goal = objective.getItemGoal() != null ? objective.getItemGoal()
|
||||
final ItemStack goal = objective.getGoalObject() instanceof ItemStack ? (ItemStack) objective
|
||||
: new ItemStack(Material.AIR, objective.getGoal());
|
||||
if (!getCurrentStage(quest).getObjectiveOverrides().isEmpty()) {
|
||||
for (final String s: getCurrentStage(quest).getObjectiveOverrides()) {
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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
|
||||
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* 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.entity;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class CountableMob {
|
||||
|
||||
private EntityType entityType;
|
||||
private int count;
|
||||
|
||||
public CountableMob(EntityType entityType, int count) {
|
||||
this.entityType = entityType;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public EntityType getEntityType() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public void setEntityType(final EntityType entityType) {
|
||||
this.entityType = entityType;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(final int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
@ -12,12 +12,14 @@
|
||||
|
||||
package me.blackvein.quests.item;
|
||||
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
import me.blackvein.quests.player.IQuester;
|
||||
import me.blackvein.quests.quests.BukkitObjective;
|
||||
import me.blackvein.quests.quests.IQuest;
|
||||
import me.blackvein.quests.quests.Objective;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import net.md_5.bungee.api.chat.TranslatableComponent;
|
||||
@ -72,21 +74,38 @@ public class QuestJournal {
|
||||
title.setColor(net.md_5.bungee.api.ChatColor.DARK_PURPLE);
|
||||
title.setBold(true);
|
||||
final BookUtil.PageBuilder builder = new BookUtil.PageBuilder().add(title).newLine();
|
||||
for (final Objective obj : owner.getCurrentObjectivesTemp(quest, false, false)) {
|
||||
if (obj.getMessage() != null && obj.getMessage().contains("<item>")) {
|
||||
final String[] split = obj.getMessage().split("<item>");
|
||||
builder.add(split[0]);
|
||||
if (plugin.getSettings().canTranslateNames() && obj.getItemGoal() != null) {
|
||||
final TranslatableComponent tc = new TranslatableComponent(plugin.getLocaleManager()
|
||||
.queryItemStack(obj.getItemGoal()));
|
||||
tc.setColor(net.md_5.bungee.api.ChatColor.DARK_AQUA);
|
||||
builder.add(tc);
|
||||
} else {
|
||||
builder.add(ItemUtil.getName(obj.getItemGoal()));
|
||||
for (final BukkitObjective obj : ((Quester)owner).getCurrentObjectivesTemp(quest, false, false)) {
|
||||
if (obj.getMessage() != null) {
|
||||
String[] split = null;
|
||||
if (obj.getMessage().contains("<item>") && obj.getGoalAsItem() != null) {
|
||||
split = obj.getMessage().split("<item>");
|
||||
builder.add(split[0]);
|
||||
if (plugin.getSettings().canTranslateNames()) {
|
||||
final TranslatableComponent tc = new TranslatableComponent(plugin.getLocaleManager()
|
||||
.queryItemStack(obj.getGoalAsItem()));
|
||||
tc.setColor(net.md_5.bungee.api.ChatColor.DARK_AQUA);
|
||||
builder.add(tc);
|
||||
} else {
|
||||
builder.add(ItemUtil.getName(obj.getGoalAsItem()));
|
||||
}
|
||||
builder.add(split[1]).newLine();
|
||||
}
|
||||
if (obj.getMessage().contains("<mob>") && obj.getGoalAsMob() != null) {
|
||||
split = obj.getMessage().split("<mob>");
|
||||
builder.add(split[0]);
|
||||
if (plugin.getSettings().canTranslateNames()) {
|
||||
final TranslatableComponent tc = new TranslatableComponent(plugin.getLocaleManager()
|
||||
.queryEntityType(obj.getGoalAsMob().getEntityType(), null)); // TODO extra data
|
||||
tc.setColor(net.md_5.bungee.api.ChatColor.DARK_RED);
|
||||
builder.add(tc);
|
||||
} else {
|
||||
builder.add(MiscUtil.snakeCaseToUpperCamelCase(obj.getGoalAsMob().getEntityType().name()));
|
||||
}
|
||||
builder.add(split[1]).newLine();
|
||||
}
|
||||
if (split == null) {
|
||||
builder.add(obj.getMessage()).newLine();
|
||||
}
|
||||
builder.add(split[1]).newLine();
|
||||
} else {
|
||||
builder.add(obj.getMessage()).newLine();
|
||||
}
|
||||
}
|
||||
pages.add(builder.build());
|
||||
|
@ -12,17 +12,19 @@
|
||||
|
||||
package me.blackvein.quests.quests;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import me.blackvein.quests.entity.CountableMob;
|
||||
import me.blackvein.quests.enums.ObjectiveType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BukkitObjective implements Objective {
|
||||
private final ObjectiveType type;
|
||||
private final String message;
|
||||
private final int progress;
|
||||
private final int goal;
|
||||
private final ItemStack progressStack;
|
||||
private final ItemStack goalStack;
|
||||
private final Object progressObj;
|
||||
private final Object goalObj;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #BukkitObjective(ObjectiveType, String, int, int)} with null message
|
||||
@ -32,61 +34,97 @@ public class BukkitObjective implements Objective {
|
||||
this.message = null;
|
||||
this.progress = progress;
|
||||
this.goal = goal;
|
||||
this.progressStack = null;
|
||||
this.goalStack = null;
|
||||
this.progressObj = new Object();
|
||||
this.goalObj = new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #BukkitObjective(ObjectiveType, String, ItemStack, ItemStack)} with null message
|
||||
* @deprecated Use {@link #BukkitObjective(ObjectiveType, String, Object, Object)} with null message
|
||||
*/
|
||||
public BukkitObjective(final ObjectiveType type, final ItemStack progress, final ItemStack goal) {
|
||||
this.type = type;
|
||||
this.message = null;
|
||||
this.progress = progress.getAmount();
|
||||
this.goal = goal.getAmount();
|
||||
this.progressStack = progress;
|
||||
this.goalStack = goal;
|
||||
this.progressObj = progress;
|
||||
this.goalObj = goal;
|
||||
}
|
||||
|
||||
public BukkitObjective(final ObjectiveType type, final String message, final int progress, final int goal) {
|
||||
public BukkitObjective(final ObjectiveType type, @Nullable final String message, final int progress,
|
||||
final int goal) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.progress = progress;
|
||||
this.goal = goal;
|
||||
this.progressStack = null;
|
||||
this.goalStack = null;
|
||||
this.progressObj = new Object();
|
||||
this.goalObj = new Object();
|
||||
}
|
||||
|
||||
public BukkitObjective(final ObjectiveType type, final String message, final ItemStack progress, final ItemStack goal) {
|
||||
public BukkitObjective(final ObjectiveType type, @Nullable final String message, final @NotNull Object progress,
|
||||
final @NotNull Object goal) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.progress = progress.getAmount();
|
||||
this.goal = goal.getAmount();
|
||||
this.progressStack = progress;
|
||||
this.goalStack = goal;
|
||||
this.progressObj = progress;
|
||||
this.goalObj = goal;
|
||||
if (progressObj instanceof ItemStack) {
|
||||
this.progress = ((ItemStack) progressObj).getAmount();
|
||||
} else if (progressObj instanceof CountableMob) {
|
||||
this.progress = ((CountableMob) progressObj).getCount();
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
if (goalObj instanceof ItemStack) {
|
||||
this.goal = ((ItemStack) goalObj).getAmount();
|
||||
} else if (goalObj instanceof CountableMob) {
|
||||
this.goal = ((CountableMob) goalObj).getCount();
|
||||
} else {
|
||||
this.goal = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ObjectiveType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGoal() {
|
||||
return goal;
|
||||
}
|
||||
|
||||
public ItemStack getItemProgress() {
|
||||
return progressStack;
|
||||
|
||||
@Override
|
||||
public @NotNull Object getProgressObject() {
|
||||
return progressObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Object getGoalObject() {
|
||||
return goalObj;
|
||||
}
|
||||
|
||||
public ItemStack getItemGoal() {
|
||||
return goalStack;
|
||||
public @Nullable ItemStack getProgressAsItem() {
|
||||
return progressObj instanceof ItemStack ? (ItemStack) progressObj : null;
|
||||
}
|
||||
|
||||
public @Nullable ItemStack getGoalAsItem() {
|
||||
return goalObj instanceof ItemStack ? (ItemStack) goalObj : null;
|
||||
}
|
||||
|
||||
public @Nullable CountableMob getProgressAsMob() {
|
||||
return progressObj instanceof CountableMob ? (CountableMob) progressObj : null;
|
||||
}
|
||||
|
||||
public @Nullable CountableMob getGoalAsMob() {
|
||||
return goalObj instanceof CountableMob ? (CountableMob) goalObj : null;
|
||||
}
|
||||
}
|
||||
|
2
dist/pom.xml
vendored
2
dist/pom.xml
vendored
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
<artifactId>quests-dist</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
4
pom.xml
4
pom.xml
@ -6,12 +6,12 @@
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
<name>quests</name>
|
||||
<url>https://github.com/PikaMug/Quests/</url>
|
||||
|
||||
<properties>
|
||||
<revision>4.2.4</revision>
|
||||
<revision>4.3.0</revision>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests-parent</artifactId>
|
||||
<version>4.2.4</version>
|
||||
<version>4.3.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
|
Loading…
Reference in New Issue
Block a user