mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-26 04:36:06 +01:00
Prevent sending of most empty quester strings, fixes #1545
This commit is contained in:
parent
ebe13ea162
commit
f315916124
@ -263,9 +263,8 @@ public class Quest implements Comparable<Quest> {
|
||||
updateCompass(quester, nextStage);
|
||||
if (player.isOnline()) {
|
||||
final Player p = quester.getPlayer();
|
||||
String msg = Lang.get(p, "questObjectivesTitle");
|
||||
msg = msg.replace("<quest>", name);
|
||||
p.sendMessage(ChatColor.GOLD + msg);
|
||||
final String msg = Lang.get(p, "objectives").replace("<quest>", name);
|
||||
quester.sendMessage(ChatColor.GOLD + msg);
|
||||
plugin.showObjectives(this, quester, false);
|
||||
final String stageStartMessage = quester.getCurrentStage(this).startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
@ -546,14 +545,13 @@ public class Quest implements Comparable<Quest> {
|
||||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
final Player p = (Player)player;
|
||||
for (final ItemStack i : rews.getItems()) {
|
||||
try {
|
||||
InventoryUtil.addItem(p, i);
|
||||
InventoryUtil.addItem(player.getPlayer(), i);
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().severe("Unable to add null reward item to inventory of "
|
||||
+ player.getName() + " upon completion of quest " + name);
|
||||
p.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
q.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
+ "Please contact an administrator.");
|
||||
}
|
||||
issuedReward = true;
|
||||
@ -643,14 +641,13 @@ public class Quest implements Comparable<Quest> {
|
||||
if (lb.getItemList().isEmpty() == false) {
|
||||
phatLootItems.addAll(lb.getItemList());
|
||||
if (player.isOnline()) {
|
||||
final Player p = (Player)player;
|
||||
for (final ItemStack is : lb.getItemList()) {
|
||||
try {
|
||||
InventoryUtil.addItem(p, is);
|
||||
InventoryUtil.addItem(player.getPlayer(), is);
|
||||
} catch (final Exception e) {
|
||||
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + p.getName()
|
||||
plugin.getLogger().severe("Unable to add PhatLoots item to inventory of " + player.getName()
|
||||
+ " upon completion of quest " + name);
|
||||
p.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
q.sendMessage(ChatColor.RED + "Quests encountered a problem with an item. "
|
||||
+ "Please contact an administrator.");
|
||||
}
|
||||
}
|
||||
@ -696,13 +693,13 @@ public class Quest implements Comparable<Quest> {
|
||||
// Inform player
|
||||
if (player.isOnline()) {
|
||||
final Player p = (Player)player;
|
||||
p.sendMessage(ChatColor.GOLD + Lang.get(p, "questCompleteTitle").replace("<quest>", ChatColor.YELLOW + name
|
||||
q.sendMessage(ChatColor.GOLD + Lang.get(p, "questCompleteTitle").replace("<quest>", ChatColor.YELLOW + name
|
||||
+ ChatColor.GOLD));
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + p.getName()
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
+ " title " + "{\"text\":\"" + Lang.get(p, "quest") + " " + Lang.get(p, "complete")
|
||||
+ "\",\"color\":\"gold\"}");
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + p.getName()
|
||||
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
|
||||
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
|
||||
}
|
||||
p.sendMessage(ChatColor.GREEN + Lang.get(p, "questRewardsTitle"));
|
||||
@ -715,11 +712,11 @@ public class Quest implements Comparable<Quest> {
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(p, message);
|
||||
}
|
||||
p.sendMessage("- " + message);
|
||||
q.sendMessage("- " + message);
|
||||
}
|
||||
} else {
|
||||
if (rews.getQuestPoints() > 0) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " "
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + rews.getQuestPoints() + " "
|
||||
+ Lang.get(p, "questPoints"));
|
||||
}
|
||||
for (final ItemStack i : rews.getItems()) {
|
||||
@ -780,48 +777,48 @@ public class Quest implements Comparable<Quest> {
|
||||
text = text.replaceFirst("<enchantment>", ItemUtil.getPrettyEnchantmentName(e.getKey()));
|
||||
text = text.replaceFirst("<level>", RomanNumeral.getNumeral(e.getValue()));
|
||||
}
|
||||
p.sendMessage(text.replace("<item>", ItemUtil.getName(i)));
|
||||
q.sendMessage(text.replace("<item>", ItemUtil.getName(i)));
|
||||
}
|
||||
}
|
||||
for (final ItemStack i : phatLootItems) {
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||
q.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||
+ ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||
q.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName()
|
||||
+ ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE
|
||||
+ " " + Lang.get(p, "enchantedItem"));
|
||||
}
|
||||
} else if (i.getDurability() != 0) {
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||
+ ChatColor.GRAY + " x " + i.getAmount());
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability()
|
||||
+ ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " "
|
||||
+ Lang.get(p, "enchantedItem"));
|
||||
}
|
||||
} else {
|
||||
if (i.getEnchantments().isEmpty()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||
+ i.getAmount());
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x "
|
||||
+ i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(p, "enchantedItem"));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rews.getMoney() > 1) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
+ plugin.getDependencies().getCurrency(true));
|
||||
} else if (rews.getMoney() == 1) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + rews.getMoney() + " " + ChatColor.DARK_PURPLE
|
||||
+ plugin.getDependencies().getCurrency(false));
|
||||
}
|
||||
if (rews.getExp() > 0 || phatLootExp > 0) {
|
||||
final int tot = rews.getExp() + phatLootExp;
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " "
|
||||
+ Lang.get(p, "experience"));
|
||||
}
|
||||
if (rews.getCommands().isEmpty() == false) {
|
||||
@ -830,11 +827,11 @@ public class Quest implements Comparable<Quest> {
|
||||
if (rews.getCommandsOverrideDisplay().isEmpty() == false
|
||||
&& rews.getCommandsOverrideDisplay().size() > index) {
|
||||
if (!rews.getCommandsOverrideDisplay().get(index).trim().equals("")) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
+ rews.getCommandsOverrideDisplay().get(index));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s);
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + s);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
@ -843,10 +840,10 @@ public class Quest implements Comparable<Quest> {
|
||||
int index = 0;
|
||||
for (final String s : rews.getPermissions()) {
|
||||
if (rews.getPermissionWorlds() != null && rews.getPermissionWorlds().size() > index) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s + " (" + rews.getPermissionWorlds().get(index)
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + s + " (" + rews.getPermissionWorlds().get(index)
|
||||
+ ")");
|
||||
} else {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN + s);
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN + s);
|
||||
|
||||
}
|
||||
index++;
|
||||
@ -854,21 +851,21 @@ public class Quest implements Comparable<Quest> {
|
||||
}
|
||||
if (rews.getMcmmoSkills().isEmpty() == false) {
|
||||
for (final String s : rews.getMcmmoSkills()) {
|
||||
p.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
q.sendMessage("- " + ChatColor.DARK_GREEN
|
||||
+ rews.getMcmmoAmounts().get(rews.getMcmmoSkills().indexOf(s)) + " "
|
||||
+ ChatColor.DARK_PURPLE + s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
}
|
||||
if (rews.getHeroesClasses().isEmpty() == false) {
|
||||
for (final String s : rews.getHeroesClasses()) {
|
||||
p.sendMessage("- " + ChatColor.AQUA
|
||||
q.sendMessage("- " + ChatColor.AQUA
|
||||
+ rews.getHeroesAmounts().get(rews.getHeroesClasses().indexOf(s)) + " " + ChatColor.BLUE
|
||||
+ s + " " + Lang.get(p, "experience"));
|
||||
}
|
||||
}
|
||||
if (phatLootMessages.isEmpty() == false) {
|
||||
for (final String s : phatLootMessages) {
|
||||
p.sendMessage("- " + s);
|
||||
q.sendMessage("- " + s);
|
||||
}
|
||||
}
|
||||
for (final String s : rews.getCustomRewards().keySet()) {
|
||||
@ -886,7 +883,7 @@ public class Quest implements Comparable<Quest> {
|
||||
for (final String key : datamap.keySet()) {
|
||||
message = message.replace("%" + key + "%", datamap.get(key).toString());
|
||||
}
|
||||
p.sendMessage("- " + ChatColor.GOLD + message);
|
||||
q.sendMessage("- " + ChatColor.GOLD + message);
|
||||
} else {
|
||||
plugin.getLogger().warning("Failed to notify player: "
|
||||
+ "Custom Reward does not have an assigned name");
|
||||
@ -901,7 +898,7 @@ public class Quest implements Comparable<Quest> {
|
||||
}
|
||||
q.saveData();
|
||||
if (player.isOnline()) {
|
||||
((Player)player).updateInventory();
|
||||
player.getPlayer().updateInventory();
|
||||
}
|
||||
q.updateJournal();
|
||||
q.findCompassTarget();
|
||||
@ -951,7 +948,7 @@ public class Quest implements Comparable<Quest> {
|
||||
}
|
||||
}
|
||||
final String[] messages = {
|
||||
ChatColor.GOLD + Lang.get(player, "questObjectivesTitle").replace("<quest>", name),
|
||||
ChatColor.GOLD + Lang.get(player, "questCommandTitle").replace("<quest>", name),
|
||||
ChatColor.RED + Lang.get(player, "questFailed")
|
||||
};
|
||||
quester.quitQuest(this, messages);
|
||||
|
@ -373,6 +373,13 @@ public class Quester implements Comparable<Quester> {
|
||||
return plugin.getServer().getOfflinePlayer(id);
|
||||
}
|
||||
|
||||
public void sendMessage(final String message) {
|
||||
if (getPlayer() == null || !getPlayer().isOnline() || message.trim().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
getPlayer().sendMessage(message);
|
||||
}
|
||||
|
||||
public Stage getCurrentStage(final Quest quest) {
|
||||
if (currentQuests.containsKey(quest)) {
|
||||
return quest.getStage(currentQuests.get(quest));
|
||||
@ -454,9 +461,8 @@ public class Quester implements Comparable<Quester> {
|
||||
if (preEvent.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
final OfflinePlayer player = getOfflinePlayer();
|
||||
if (player.isOnline()) {
|
||||
final Player p = getPlayer();
|
||||
final OfflinePlayer offlinePlayer = getOfflinePlayer();
|
||||
if (offlinePlayer.isOnline()) {
|
||||
final Planner pln = q.getPlanner();
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
final long start = pln.getStartInMillis(); // Start time in milliseconds since UTC epoch
|
||||
@ -469,7 +475,7 @@ public class Quester implements Comparable<Quester> {
|
||||
early = early.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW);
|
||||
early = early.replace("<time>", ChatColor.RED
|
||||
+ MiscUtil.getTime(start - currentTime) + ChatColor.YELLOW);
|
||||
p.sendMessage(ChatColor.YELLOW + early);
|
||||
sendMessage(ChatColor.YELLOW + early);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -479,7 +485,7 @@ public class Quester implements Comparable<Quester> {
|
||||
late = late.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.RED);
|
||||
late = late.replace("<time>", ChatColor.DARK_PURPLE
|
||||
+ MiscUtil.getTime(currentTime - end) + ChatColor.RED);
|
||||
p.sendMessage(ChatColor.RED + late);
|
||||
sendMessage(ChatColor.RED + late);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -526,19 +532,19 @@ public class Quester implements Comparable<Quester> {
|
||||
// If quest is not active, or new period of activity should override player cooldown, inform user
|
||||
if (!active | (q.getPlanner().getOverride() && completedEnd > 0L
|
||||
&& currentTime < (completedEnd /*+ repeat*/))) {
|
||||
if (p.isOnline()) {
|
||||
if (getPlayer().isOnline()) {
|
||||
final String early = Lang.get("plnTooEarly")
|
||||
.replace("<quest>", ChatColor.AQUA + q.getName() + ChatColor.YELLOW)
|
||||
.replace("<time>", ChatColor.DARK_PURPLE
|
||||
+ MiscUtil.getTime((completedEnd /*+ repeat*/) - currentTime) + ChatColor.YELLOW);
|
||||
p.sendMessage(ChatColor.YELLOW + early);
|
||||
sendMessage(ChatColor.YELLOW + early);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (q.testRequirements(player) == true || ignoreReqs) {
|
||||
if (q.testRequirements(offlinePlayer) == true || ignoreReqs) {
|
||||
addEmptiesFor(q, 0);
|
||||
try {
|
||||
currentQuests.put(q, 0);
|
||||
@ -546,7 +552,7 @@ public class Quester implements Comparable<Quester> {
|
||||
plugin.getLogger().info(getPlayer().getUniqueId() + " started quest " + q.getName());
|
||||
}
|
||||
} catch (final NullPointerException npe) {
|
||||
plugin.getLogger().severe("Unable to add quest" + q.getName() + " for player " + player.getName()
|
||||
plugin.getLogger().severe("Unable to add quest" + q.getName() + " for player " + offlinePlayer.getName()
|
||||
+ ". Consider resetting player data or report on Github");
|
||||
}
|
||||
final Stage stage = q.getStage(0);
|
||||
@ -557,7 +563,7 @@ public class Quester implements Comparable<Quester> {
|
||||
plugin.getDependencies().getVaultEconomy().withdrawPlayer(getOfflinePlayer(), reqs.getMoney());
|
||||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
if (offlinePlayer.isOnline()) {
|
||||
final Player p = getPlayer();
|
||||
final ItemStack[] original = p.getInventory().getContents().clone();
|
||||
for (final ItemStack is : reqs.getItems()) {
|
||||
@ -566,7 +572,7 @@ public class Quester implements Comparable<Quester> {
|
||||
if (InventoryUtil.stripItem(p.getEquipment(), is) == false) {
|
||||
p.getInventory().setContents(original);
|
||||
p.updateInventory();
|
||||
p.sendMessage(Lang.get(p, "requirementsItemFail"));
|
||||
sendMessage(Lang.get(p, "requirementsItemFail"));
|
||||
hardQuit(q);
|
||||
return;
|
||||
}
|
||||
@ -575,68 +581,66 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
String accepted = Lang.get(getPlayer(), "questAccepted");
|
||||
accepted = accepted.replace("<quest>", q.getName());
|
||||
p.sendMessage(ChatColor.GREEN + accepted);
|
||||
sendMessage(ChatColor.GREEN + accepted);
|
||||
p.sendMessage("");
|
||||
if (plugin.getSettings().canShowQuestTitles()) {
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "title "
|
||||
+ player.getName() + " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest") + " "
|
||||
+ Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
|
||||
+ offlinePlayer.getName() + " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest")
|
||||
+ " " + Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
|
||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), "title "
|
||||
+ player.getName() + " subtitle " + "{\"text\":\"" + q.getName()
|
||||
+ offlinePlayer.getName() + " subtitle " + "{\"text\":\"" + q.getName()
|
||||
+ "\",\"color\":\"yellow\"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
if (offlinePlayer.isOnline()) {
|
||||
final Player p = getPlayer();
|
||||
String title = Lang.get(p, "questObjectivesTitle");
|
||||
title = title.replace("<quest>", q.getName());
|
||||
p.sendMessage(ChatColor.GOLD + title);
|
||||
final String title = Lang.get(p, "objectives").replace("<quest>", q.getName());
|
||||
sendMessage(ChatColor.GOLD + title);
|
||||
plugin.showObjectives(q, this, false);
|
||||
final String stageStartMessage = stage.startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
p.sendMessage(ConfigUtil
|
||||
.parseStringWithPossibleLineBreaks(stageStartMessage, q, getPlayer()));
|
||||
p.sendMessage(ConfigUtil.parseStringWithPossibleLineBreaks(stageStartMessage, q, getPlayer()));
|
||||
}
|
||||
final Condition c = stage.getCondition();
|
||||
if (c != null) {
|
||||
p.sendMessage(ChatColor.LIGHT_PURPLE + Lang.get("stageEditorConditions") + ":");
|
||||
sendMessage(ChatColor.LIGHT_PURPLE + Lang.get("stageEditorConditions"));
|
||||
if (!c.getEntitiesWhileRiding().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorRideEntity");
|
||||
for (final String e : c.getEntitiesWhileRiding()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + e;
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getPermissions().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorPermissions");
|
||||
for (final String e : c.getPermissions()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + e;
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getItemsWhileHoldingMainHand().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorItemsInMainHand");
|
||||
for (final ItemStack is : c.getItemsWhileHoldingMainHand()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + ItemUtil.getPrettyItemName(is.getType().name());
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getWorldsWhileStayingWithin().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorStayWithinWorld");
|
||||
for (final String w : c.getWorldsWhileStayingWithin()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + w;
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getBiomesWhileStayingWithin().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorStayWithinBiome");
|
||||
for (final String b : c.getBiomesWhileStayingWithin()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + MiscUtil.snakeCaseToUpperCamelCase(b);
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getRegionsWhileStayingWithin().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorStayWithinRegion");
|
||||
for (final String r : c.getRegionsWhileStayingWithin()) {
|
||||
msg += ChatColor.AQUA + "\n \u2515 " + r;
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
} else if (!c.getPlaceholdersCheckIdentifier().isEmpty()) {
|
||||
String msg = "- " + Lang.get("conditionEditorCheckPlaceholder");
|
||||
int index = 0;
|
||||
@ -647,7 +651,7 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
index++;
|
||||
}
|
||||
p.sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -670,14 +674,14 @@ public class Quester implements Comparable<Quester> {
|
||||
q.updateCompass(this, stage);
|
||||
saveData();
|
||||
} else {
|
||||
if (player.isOnline()) {
|
||||
((Player)player).sendMessage(ChatColor.DARK_AQUA + Lang.get("requirements"));
|
||||
if (offlinePlayer.isOnline()) {
|
||||
sendMessage(ChatColor.DARK_AQUA + Lang.get("requirements"));
|
||||
for (final String s : getCurrentRequirements(q, false)) {
|
||||
((Player)player).sendMessage(ChatColor.GRAY + "- " + s);
|
||||
sendMessage(ChatColor.GRAY + "- " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (player.isOnline()) {
|
||||
if (offlinePlayer.isOnline()) {
|
||||
final QuesterPostStartQuestEvent postEvent = new QuesterPostStartQuestEvent(this, q);
|
||||
plugin.getServer().getPluginManager().callEvent(postEvent);
|
||||
}
|
||||
@ -711,7 +715,7 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
for (final String message : messages) {
|
||||
if (message != null && !message.equals("") && getPlayer().isOnline()) {
|
||||
getPlayer().sendMessage(message);
|
||||
sendMessage(message);
|
||||
}
|
||||
}
|
||||
saveData();
|
||||
@ -1786,7 +1790,6 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param i The item being crafted
|
||||
*/
|
||||
public void craftItem(final Quest quest, final ItemStack i) {
|
||||
final Player player = getPlayer();
|
||||
ItemStack found = null;
|
||||
for (final ItemStack is : getQuestData(quest).itemsCrafted.keySet()) {
|
||||
if (ItemUtil.compareItems(i, is, true) == 0) {
|
||||
@ -1804,8 +1807,7 @@ public class Quester implements Comparable<Quester> {
|
||||
+ quest.getName() + " with " + i.getType() + " x " + i.getAmount()
|
||||
+ " already crafted. List amount reports value of " + amount
|
||||
+ ". Please report this error on Github!");
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "Quests had a problem crafting your item, please contact an administrator!");
|
||||
sendMessage(ChatColor.RED + "Quests had a problem crafting your item, please contact an administrator!");
|
||||
return;
|
||||
}
|
||||
final int req = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(found))
|
||||
@ -1849,7 +1851,6 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param i The item being smelted
|
||||
*/
|
||||
public void smeltItem(final Quest quest, final ItemStack i) {
|
||||
final Player player = getPlayer();
|
||||
ItemStack found = null;
|
||||
for (final ItemStack is : getQuestData(quest).itemsSmelted.keySet()) {
|
||||
if (ItemUtil.compareItems(i, is, true) == 0) {
|
||||
@ -1866,8 +1867,7 @@ public class Quester implements Comparable<Quester> {
|
||||
+ found.getAmount() + " for quest " + quest.getName() + " with " + i.getType() + " x "
|
||||
+ i.getAmount() + " already smelted. List amount reports value of " + amount
|
||||
+ ". Please report this error on Github!");
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "Quests had a problem smelting your item, please contact an administrator!");
|
||||
sendMessage(ChatColor.RED + "Quests had a problem smelting your item, please contact an administrator!");
|
||||
return;
|
||||
}
|
||||
final int req = getCurrentStage(quest).itemsToSmelt.get(getCurrentStage(quest).itemsToSmelt.indexOf(found))
|
||||
@ -1911,7 +1911,6 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param i The item being enchanted
|
||||
*/
|
||||
public void enchantItem(final Quest quest, final ItemStack i) {
|
||||
final Player player = getPlayer();
|
||||
ItemStack found = null;
|
||||
for (final ItemStack is : getQuestData(quest).itemsEnchanted.keySet()) {
|
||||
if (!is.getEnchantments().isEmpty()) {
|
||||
@ -1935,8 +1934,7 @@ public class Quester implements Comparable<Quester> {
|
||||
+ found.getAmount() + " for quest " + quest.getName() + " with " + i.getType() + " x "
|
||||
+ i.getAmount() + " already enchanted. List amount reports value of " + amount
|
||||
+ ". Please report this error on Github!");
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "Quests had a problem enchanting your item, please contact an administrator!");
|
||||
sendMessage(ChatColor.RED + "Quests had a problem enchanting your item, please contact an administrator!");
|
||||
return;
|
||||
}
|
||||
final int req = getCurrentStage(quest).itemsToEnchant.get(getCurrentStage(quest).itemsToEnchant
|
||||
@ -1980,7 +1978,6 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param i The item being brewed
|
||||
*/
|
||||
public void brewItem(final Quest quest, final ItemStack i) {
|
||||
final Player player = getPlayer();
|
||||
ItemStack found = null;
|
||||
for (final ItemStack is : getQuestData(quest).itemsBrewed.keySet()) {
|
||||
if (ItemUtil.compareItems(i, is, true) == 0) {
|
||||
@ -1997,8 +1994,7 @@ public class Quester implements Comparable<Quester> {
|
||||
+ found.getAmount() + " for quest " + quest.getName() + " with " + i.getType() + " x "
|
||||
+ i.getAmount() + " already smelted. List amount reports value of " + amount
|
||||
+ ". Please report this error on Github!");
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "Quests had a problem brewing your item, please contact an administrator!");
|
||||
sendMessage(ChatColor.RED + "Quests had a problem brewing your item, please contact an administrator!");
|
||||
return;
|
||||
}
|
||||
final int req = getCurrentStage(quest).itemsToBrew.get(getCurrentStage(quest).itemsToBrew.indexOf(found))
|
||||
@ -2042,7 +2038,6 @@ public class Quester implements Comparable<Quester> {
|
||||
* @param i The item being consumed
|
||||
*/
|
||||
public void consumeItem(final Quest quest, final ItemStack i) {
|
||||
final Player player = getPlayer();
|
||||
ItemStack found = null;
|
||||
for (final ItemStack is : getQuestData(quest).itemsConsumed.keySet()) {
|
||||
if (ItemUtil.compareItems(i, is, true) == 0) {
|
||||
@ -2059,8 +2054,7 @@ public class Quester implements Comparable<Quester> {
|
||||
+ found.getAmount() + " for quest " + quest.getName() + " with " + i.getType() + " x "
|
||||
+ i.getAmount() + " already consumed. List amount reports value of " + amount
|
||||
+ ". Please report this error on Github!");
|
||||
player.sendMessage(ChatColor.RED
|
||||
+ "Quests had a problem consuming your item, please contact an administrator!");
|
||||
sendMessage(ChatColor.RED + "Quests had a problem consuming your item, please contact an administrator!");
|
||||
return;
|
||||
}
|
||||
final int req = getCurrentStage(quest).itemsToConsume.get(getCurrentStage(quest).itemsToConsume.indexOf(found))
|
||||
@ -2487,7 +2481,6 @@ public class Quester implements Comparable<Quester> {
|
||||
new Objective(type, locationsReached, locationsToReach));
|
||||
plugin.getServer().getPluginManager().callEvent(preEvent);
|
||||
|
||||
// TODO - Find proper cause of Github issues #646 and #825 and #1191
|
||||
if (locationsReached <= index) {
|
||||
getQuestData(quest).hasReached.add(true);
|
||||
finishObjective(quest, new Objective(type, new ItemStack(Material.AIR, 1),
|
||||
@ -2706,11 +2699,10 @@ public class Quester implements Comparable<Quester> {
|
||||
if (plugin.getDependencies().getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(p, message);
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.PASSWORD)) {
|
||||
final String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass;
|
||||
p.sendMessage(message);
|
||||
sendMessage(ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass);
|
||||
} else if (type.equals(ObjectiveType.BREAK_BLOCK)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "break");
|
||||
if (message.contains("<count>")) {
|
||||
@ -2723,7 +2715,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.DAMAGE_BLOCK)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "damage");
|
||||
@ -2737,7 +2729,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.PLACE_BLOCK)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "place");
|
||||
@ -2751,7 +2743,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.USE_BLOCK)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "use");
|
||||
@ -2765,7 +2757,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.CUT_BLOCK)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "cut");
|
||||
@ -2779,7 +2771,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, increment.getType(), increment.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(increment)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.CRAFT_ITEM)) {
|
||||
final ItemStack is = getCurrentStage(quest).itemsToCraft.get(getCurrentStage(quest).itemsToCraft.indexOf(goal));
|
||||
@ -2794,7 +2786,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.SMELT_ITEM)) {
|
||||
final ItemStack is = getCurrentStage(quest).itemsToSmelt.get(getCurrentStage(quest).itemsToSmelt.indexOf(goal));
|
||||
@ -2809,7 +2801,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.ENCHANT_ITEM)) {
|
||||
final ItemStack is = getCurrentStage(quest).itemsToEnchant.get(getCurrentStage(quest).itemsToEnchant.indexOf(goal));
|
||||
@ -2831,7 +2823,7 @@ public class Quester implements Comparable<Quester> {
|
||||
goal.getEnchantments());
|
||||
} else {
|
||||
for (final Entry<Enchantment, Integer> e : is.getEnchantments().entrySet()) {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
.replace("<enchantment>", ItemUtil.getPrettyEnchantmentName(e.getKey()))
|
||||
.replace("<level>", RomanNumeral.getNumeral(e.getValue())));
|
||||
}
|
||||
@ -2855,7 +2847,7 @@ public class Quester implements Comparable<Quester> {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(),
|
||||
goal.getEnchantments());
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.CONSUME_ITEM)) {
|
||||
final ItemStack is = getCurrentStage(quest).itemsToConsume.get(getCurrentStage(quest).itemsToConsume
|
||||
@ -2871,7 +2863,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, goal.getType(), goal.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.DELIVER_ITEM)) {
|
||||
final ItemStack is = getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver
|
||||
@ -2889,7 +2881,7 @@ public class Quester implements Comparable<Quester> {
|
||||
&& !goal.getItemMeta().hasDisplayName()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, is.getType(), is.getDurability(), null);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.MILK_COW)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "milkCow");
|
||||
@ -2899,7 +2891,7 @@ public class Quester implements Comparable<Quester> {
|
||||
// Legacy
|
||||
message += ChatColor.GREEN + ": " + goal.getAmount() + "/" + goal.getAmount();
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.CATCH_FISH)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "catchFish");
|
||||
if (message.contains("<count>")) {
|
||||
@ -2908,7 +2900,7 @@ public class Quester implements Comparable<Quester> {
|
||||
// Legacy
|
||||
message += ChatColor.GREEN + ": " + goal.getAmount() + "/" + goal.getAmount();
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.KILL_MOB)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill");
|
||||
if (message.contains("<count>")) {
|
||||
@ -2921,7 +2913,7 @@ public class Quester implements Comparable<Quester> {
|
||||
if (plugin.getSettings().canTranslateNames()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, mob, extra);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<mob>", MiscUtil.snakeCaseToUpperCamelCase(mob.name())));
|
||||
sendMessage(message.replace("<mob>", MiscUtil.snakeCaseToUpperCamelCase(mob.name())));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.KILL_PLAYER)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "killPlayer");
|
||||
@ -2931,11 +2923,11 @@ public class Quester implements Comparable<Quester> {
|
||||
// Legacy
|
||||
message += ChatColor.GREEN + ": " + goal.getAmount() + "/" + goal.getAmount();
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.TALK_TO_NPC)) {
|
||||
final String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "talkTo")
|
||||
.replace("<npc>", plugin.getDependencies().getNPCName(npc.getId()));
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.KILL_NPC)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill");
|
||||
if (message.contains("<count>")) {
|
||||
@ -2945,7 +2937,7 @@ public class Quester implements Comparable<Quester> {
|
||||
message += ChatColor.AQUA + " <mob>" + ChatColor.GREEN + ": " + goal.getAmount() + "/"
|
||||
+ goal.getAmount();
|
||||
}
|
||||
p.sendMessage(message.replace("<mob>", plugin.getDependencies().getNPCName(npc.getId())));
|
||||
sendMessage(message.replace("<mob>", plugin.getDependencies().getNPCName(npc.getId())));
|
||||
} else if (type.equals(ObjectiveType.TAME_MOB)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame");
|
||||
if (!message.contains("<mob>")) {
|
||||
@ -2960,7 +2952,7 @@ public class Quester implements Comparable<Quester> {
|
||||
if (plugin.getSettings().canTranslateNames()) {
|
||||
plugin.getLocaleQuery().sendMessage(p, message, mob, extra);
|
||||
} else {
|
||||
p.sendMessage(message.replace("<mob>", MiscUtil.snakeCaseToUpperCamelCase(mob.name())));
|
||||
sendMessage(message.replace("<mob>", MiscUtil.snakeCaseToUpperCamelCase(mob.name())));
|
||||
}
|
||||
} else if (type.equals(ObjectiveType.SHEAR_SHEEP)) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "shearSheep");
|
||||
@ -2971,7 +2963,7 @@ public class Quester implements Comparable<Quester> {
|
||||
// Legacy
|
||||
message += ChatColor.GREEN + ": " + goal.getAmount() + "/" + goal.getAmount();
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (type.equals(ObjectiveType.REACH_LOCATION)) {
|
||||
String obj = Lang.get(p, "goTo");
|
||||
try {
|
||||
@ -2983,7 +2975,7 @@ public class Quester implements Comparable<Quester> {
|
||||
obj = obj.replace("<location>", "ERROR");
|
||||
}
|
||||
final String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
} else if (co != null) {
|
||||
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + co.getDisplay();
|
||||
int index = -1;
|
||||
@ -3006,7 +2998,7 @@ public class Quester implements Comparable<Quester> {
|
||||
if (co.canShowCount()) {
|
||||
message = message.replace("%count%", goal.getAmount() + "/" + goal.getAmount());
|
||||
}
|
||||
p.sendMessage(message);
|
||||
sendMessage(message);
|
||||
}
|
||||
if (testComplete(quest)) {
|
||||
quest.nextStage(this, true);
|
||||
@ -3693,10 +3685,8 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
}
|
||||
if (!exists) {
|
||||
if (getPlayer() != null && getPlayer().isOnline()) {
|
||||
getPlayer().sendMessage(ChatColor.RED + Lang.get("questNotExist")
|
||||
.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED));
|
||||
}
|
||||
sendMessage(ChatColor.RED + Lang.get("questNotExist").replace("<quest>", ChatColor.DARK_PURPLE
|
||||
+ quest.getName() + ChatColor.RED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3924,13 +3914,13 @@ public class Quester implements Comparable<Quester> {
|
||||
final Stage stage = getCurrentStage(quest);
|
||||
if (stage != null) {
|
||||
quest.updateCompass(Quester.this, stage);
|
||||
if (notify && getPlayer().isOnline()) {
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + Lang.get(getPlayer(), "compassSet")
|
||||
if (notify) {
|
||||
sendMessage(ChatColor.YELLOW + Lang.get(getPlayer(), "compassSet")
|
||||
.replace("<quest>", ChatColor.GOLD + quest.getName() + ChatColor.YELLOW));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getPlayer().sendMessage(ChatColor.RED + Lang.get(getPlayer(), "journalNoQuests")
|
||||
sendMessage(ChatColor.RED + Lang.get(getPlayer(), "journalNoQuests")
|
||||
.replace("<journal>", Lang.get(getPlayer(), "journalTitle")));
|
||||
}
|
||||
}
|
||||
@ -4106,7 +4096,7 @@ public class Quester implements Comparable<Quester> {
|
||||
final String s = ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD
|
||||
+ " -\n" + "\n" + ChatColor.RESET + quest.getDescription() + "\n";
|
||||
for (final String msg : s.split("<br>")) {
|
||||
getPlayer().sendMessage(msg);
|
||||
sendMessage(msg);
|
||||
}
|
||||
if (!plugin.getSettings().canAskConfirmation()) {
|
||||
takeQuest(quest, false);
|
||||
@ -4115,7 +4105,7 @@ public class Quester implements Comparable<Quester> {
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + Lang.get(getPlayer(), "alreadyConversing"));
|
||||
sendMessage(ChatColor.YELLOW + Lang.get(getPlayer(), "alreadyConversing"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4136,22 +4126,22 @@ public class Quester implements Comparable<Quester> {
|
||||
if (getCurrentQuests().size() >= plugin.getSettings().getMaxQuests() && plugin.getSettings().getMaxQuests()
|
||||
> 0) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "questMaxAllowed");
|
||||
msg = msg.replace("<number>", String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
final String msg = Lang.get(getPlayer(), "questMaxAllowed").replace("<number>",
|
||||
String.valueOf(plugin.getSettings().getMaxQuests()));
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (getCurrentQuests().containsKey(quest)) {
|
||||
if (giveReason) {
|
||||
final String msg = Lang.get(getPlayer(), "questAlreadyOn");
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (getCompletedQuests().contains(quest) && quest.getPlanner().getCooldown() < 0) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "questAlreadyCompleted");
|
||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.YELLOW);
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
final String msg = Lang.get(getPlayer(), "questAlreadyCompleted")
|
||||
.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.YELLOW);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (plugin.getDependencies().getCitizens() != null
|
||||
@ -4161,33 +4151,32 @@ public class Quester implements Comparable<Quester> {
|
||||
getPlayer().getLocation().getWorld().getName())
|
||||
&& quest.getNpcStart().getEntity().getLocation().distance(getPlayer().getLocation()) > 6.0) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "mustSpeakTo");
|
||||
msg = msg.replace("<npc>", ChatColor.DARK_PURPLE + quest.getNpcStart().getName() + ChatColor.YELLOW);
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
final String msg = Lang.get(getPlayer(), "mustSpeakTo").replace("<npc>", ChatColor.DARK_PURPLE
|
||||
+ quest.getNpcStart().getName() + ChatColor.YELLOW);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (quest.getBlockStart() != null) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "noCommandStart");
|
||||
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.YELLOW);
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
final String msg = Lang.get(getPlayer(), "noCommandStart").replace("<quest>", ChatColor.DARK_PURPLE
|
||||
+ quest.getName() + ChatColor.YELLOW);
|
||||
sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (getCompletedQuests().contains(quest) && getRemainingCooldown(quest) > 0
|
||||
&& !quest.getPlanner().getOverride()) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "questTooEarly");
|
||||
msg = msg.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
|
||||
msg = msg.replace("<time>", ChatColor.DARK_PURPLE + MiscUtil.getTime(getRemainingCooldown(quest))
|
||||
+ ChatColor.YELLOW);
|
||||
final String msg = Lang.get(getPlayer(), "questTooEarly").replace("<quest>", ChatColor.AQUA
|
||||
+ quest.getName()+ ChatColor.YELLOW).replace("<time>", ChatColor.DARK_PURPLE
|
||||
+ MiscUtil.getTime(getRemainingCooldown(quest)) + ChatColor.YELLOW);
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
} else if (quest.getRegionStart() != null) {
|
||||
if (!quest.isInRegionStart(this)) {
|
||||
if (giveReason) {
|
||||
String msg = Lang.get(getPlayer(), "questInvalidLocation");
|
||||
msg = msg.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
|
||||
final String msg = Lang.get(getPlayer(), "questInvalidLocation").replace("<quest>", ChatColor.AQUA
|
||||
+ quest.getName() + ChatColor.YELLOW);
|
||||
getPlayer().sendMessage(ChatColor.YELLOW + msg);
|
||||
}
|
||||
return false;
|
||||
@ -4236,8 +4225,8 @@ public class Quester implements Comparable<Quester> {
|
||||
if (getPlayer() == null) {
|
||||
return false;
|
||||
}
|
||||
if (plugin.getDependencies().getWorldGuardApi()
|
||||
.getApplicableRegionsIDs(getPlayer().getWorld(), getPlayer().getLocation()).contains(regionID)) {
|
||||
if (plugin.getDependencies().getWorldGuardApi().getApplicableRegionsIDs(getPlayer().getWorld(),
|
||||
getPlayer().getLocation()).contains(regionID)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -887,12 +887,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
if (!ignoreOverrides && !quester.getCurrentStage(quest).objectiveOverrides.isEmpty()) {
|
||||
for (final String s: quester.getCurrentStage(quest).objectiveOverrides) {
|
||||
String message = ChatColor.GREEN + ConfigUtil.parseString(
|
||||
ChatColor.translateAlternateColorCodes('&', s), quest, quester.getPlayer());
|
||||
String message = ChatColor.GREEN + (s.trim().length() > 0 ? "- " : "") + ConfigUtil
|
||||
.parseString(ChatColor.translateAlternateColorCodes('&', s), quest, quester.getPlayer());
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -902,7 +902,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final ItemStack e2 : data.blocksBroken) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
final ChatColor color = e2.getAmount() < e.getAmount() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "break");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "break");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
@ -915,7 +915,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames() && !e.hasItemMeta() && !e.getItemMeta().hasDisplayName()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getType(), e.getDurability(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -924,7 +924,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final ItemStack e2 : data.blocksDamaged) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
final ChatColor color = e2.getAmount() < e.getAmount() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "damage");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "damage");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
@ -937,7 +937,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames() && !e.hasItemMeta() && !e.getItemMeta().hasDisplayName()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getType(), e.getDurability(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -946,7 +946,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final ItemStack e2 : data.blocksPlaced) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
final ChatColor color = e2.getAmount() < e.getAmount() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "place");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "place");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
@ -959,7 +959,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames() && !e.hasItemMeta() && !e.getItemMeta().hasDisplayName()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getType(), e.getDurability(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -968,7 +968,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final ItemStack e2 : data.blocksUsed) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
final ChatColor color = e2.getAmount() < e.getAmount() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "use");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "use");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
@ -981,7 +981,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames() && !e.hasItemMeta() && !e.getItemMeta().hasDisplayName()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getType(), e.getDurability(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -990,7 +990,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final ItemStack e2 : data.blocksCut) {
|
||||
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
|
||||
final ChatColor color = e2.getAmount() < e.getAmount() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "cut");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "cut");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getAmount() + "/" + e.getAmount());
|
||||
} else {
|
||||
@ -1003,7 +1003,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames() && !e.hasItemMeta() && !e.getItemMeta().hasDisplayName()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getType(), e.getDurability(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1015,7 +1015,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
final int amt = is.getAmount();
|
||||
final ChatColor color = crafted < amt ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "craftItem");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "craftItem");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + crafted + "/" + is.getAmount());
|
||||
} else {
|
||||
@ -1029,7 +1029,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, is.getType(), is.getDurability(),
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
}
|
||||
for (final ItemStack is : stage.itemsToSmelt) {
|
||||
@ -1039,7 +1039,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
final int amt = is.getAmount();
|
||||
final ChatColor color = smelted < amt ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "smeltItem");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "smeltItem");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + smelted + "/" + is.getAmount());
|
||||
} else {
|
||||
@ -1053,7 +1053,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, is.getType(), is.getDurability(),
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
}
|
||||
for (final ItemStack is : stage.itemsToEnchant) {
|
||||
@ -1063,7 +1063,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
final int amt = is.getAmount();
|
||||
final ChatColor color = enchanted < amt ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "enchItem");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "enchItem");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + enchanted + "/" + is.getAmount());
|
||||
} else {
|
||||
@ -1084,13 +1084,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
if (is.getEnchantments().isEmpty()) {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
.replace("<enchantment>", "")
|
||||
.replace("<level>", "")
|
||||
.replaceAll("\\s+", " "));
|
||||
} else {
|
||||
for (final Entry<Enchantment, Integer> e : is.getEnchantments().entrySet()) {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is))
|
||||
.replace("<enchantment>", ItemUtil.getPrettyEnchantmentName(e.getKey()))
|
||||
.replace("<level>", RomanNumeral.getNumeral(e.getValue())));
|
||||
}
|
||||
@ -1104,7 +1104,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
final int amt = is.getAmount();
|
||||
final ChatColor color = brewed < amt ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "brewItem");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "brewItem");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + brewed + "/" + is.getAmount());
|
||||
} else {
|
||||
@ -1124,7 +1124,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, is.getType(), is.getDurability(),
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
}
|
||||
for (final ItemStack is : stage.itemsToConsume) {
|
||||
@ -1134,7 +1134,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
final int amt = is.getAmount();
|
||||
final ChatColor color = consumed < amt ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "consumeItem");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "consumeItem");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + consumed + "/" + is.getAmount());
|
||||
} else {
|
||||
@ -1148,12 +1148,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, is.getType(), is.getDurability(),
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
}
|
||||
if (stage.cowsToMilk != null) {
|
||||
final ChatColor color = data.getCowsMilked() < stage.cowsToMilk ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "milkCow");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "milkCow");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + data.getCowsMilked() + "/" + stage.cowsToMilk);
|
||||
} else {
|
||||
@ -1163,11 +1163,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
if (stage.fishToCatch != null) {
|
||||
final ChatColor color = data.getFishCaught() < stage.fishToCatch ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "catchFish");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "catchFish");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + data.getFishCaught() + "/" + stage.fishToCatch);
|
||||
} else {
|
||||
@ -1177,7 +1177,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
for (final EntityType e : stage.mobsToKill) {
|
||||
for (final EntityType e2 : data.mobsKilled) {
|
||||
@ -1219,7 +1219,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e, null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<mob>", MiscUtil.getProperMobName(e)));
|
||||
quester.sendMessage(message.replace("<mob>", MiscUtil.getProperMobName(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1227,7 +1227,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
if (stage.playersToKill != null) {
|
||||
final ChatColor color = data.getPlayersKilled() < stage.playersToKill ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "killPlayer");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "killPlayer");
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + data.getPlayersKilled() + "/" + stage.playersToKill);
|
||||
} else {
|
||||
@ -1237,7 +1237,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
int index = 0;
|
||||
for (final ItemStack is : stage.itemsToDeliver) {
|
||||
@ -1249,7 +1249,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
final Integer npc = stage.itemDeliveryTargets.get(index);
|
||||
index++;
|
||||
final ChatColor color = delivered < toDeliver ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "deliver").replace("<npc>", depends.getNPCName(npc));
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "deliver").replace("<npc>", depends.getNPCName(npc));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + delivered + "/" + toDeliver);
|
||||
} else {
|
||||
@ -1263,19 +1263,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, is.getType(), is.getDurability(),
|
||||
is.getEnchantments());
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
quester.sendMessage(message.replace("<item>", ItemUtil.getName(is)));
|
||||
}
|
||||
}
|
||||
for (final Integer n : stage.citizensToInteract) {
|
||||
for (final Entry<Integer, Boolean> e : data.citizensInteracted.entrySet()) {
|
||||
if (e.getKey().equals(n)) {
|
||||
final ChatColor color = e.getValue() == false ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "talkTo")
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "talkTo")
|
||||
.replace("<npc>", depends.getNPCName(n));
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1287,7 +1287,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
final ChatColor color = data.citizenNumKilled.get(data.citizensKilled.indexOf(n2))
|
||||
< stage.citizenNumToKill.get(stage.citizensToKill.indexOf(n)) == false
|
||||
? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "kill");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "kill");
|
||||
if (message.contains("<mob>")) {
|
||||
message = message.replace("<mob>", depends.getNPCName(n));
|
||||
} else {
|
||||
@ -1305,7 +1305,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (depends.getPlaceholderApi() != null) {
|
||||
message = PlaceholderAPI.setPlaceholders(quester.getPlayer(), message);
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1314,7 +1314,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final Entry<EntityType, Integer> e2 : data.mobsTamed.entrySet()) {
|
||||
if (e.getKey().equals(e2.getKey())) {
|
||||
final ChatColor color = e2.getValue() < e.getValue() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "tame");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "tame");
|
||||
if (!message.contains("<mob>")) {
|
||||
message += " <mob>";
|
||||
}
|
||||
@ -1327,7 +1327,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (getSettings().canTranslateNames()) {
|
||||
localeQuery.sendMessage(quester.getPlayer(), message, e.getKey(), null);
|
||||
} else {
|
||||
quester.getPlayer().sendMessage(message.replace("<mob>",
|
||||
quester.sendMessage(message.replace("<mob>",
|
||||
MiscUtil.getProperMobName(e.getKey())));
|
||||
}
|
||||
}
|
||||
@ -1337,7 +1337,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
for (final Entry<DyeColor, Integer> e2 : data.sheepSheared.entrySet()) {
|
||||
if (e.getKey().equals(e2.getKey())) {
|
||||
final ChatColor color = e2.getValue() < e.getValue() ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "shearSheep");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "shearSheep");
|
||||
message = message.replace("<color>", MiscUtil.getPrettyDyeColorName(e.getKey()));
|
||||
if (message.contains("<count>")) {
|
||||
message = message.replace("<count>", "" + color + e2.getValue() + "/" + e.getValue());
|
||||
@ -1345,7 +1345,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
// Legacy
|
||||
message += color + ": " + e2.getValue() + "/" + e.getValue();
|
||||
}
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1355,10 +1355,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (!data.hasReached.isEmpty()) {
|
||||
final ChatColor color = data.hasReached.get(data.locationsReached.indexOf(l2)) == false
|
||||
? ChatColor.GREEN : ChatColor.GRAY;
|
||||
String message = color + Lang.get(quester.getPlayer(), "goTo");
|
||||
String message = color + "- " + Lang.get(quester.getPlayer(), "goTo");
|
||||
message = message.replace("<location>",
|
||||
stage.locationNames.get(stage.locationsToReach.indexOf(l)));
|
||||
quester.getPlayer().sendMessage(message);
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1367,8 +1367,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
if (data.passwordsSaid.containsKey(s)) {
|
||||
final Boolean b = data.passwordsSaid.get(s);
|
||||
final ChatColor color = b != null && !b == false ? ChatColor.GREEN : ChatColor.GRAY;
|
||||
final String message = color + s;
|
||||
quester.getPlayer().sendMessage(message);
|
||||
final String message = color + "- " + s;
|
||||
quester.sendMessage(message);
|
||||
}
|
||||
}
|
||||
for (final CustomObjective co : stage.customObjectives) {
|
||||
@ -1411,10 +1411,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
countsIndex++;
|
||||
}
|
||||
for (final String s : unfinished) {
|
||||
quester.getPlayer().sendMessage(ChatColor.GREEN + s);
|
||||
quester.sendMessage(ChatColor.GREEN + "- " + s);
|
||||
}
|
||||
for (final String s : finished) {
|
||||
quester.getPlayer().sendMessage(ChatColor.GRAY + s);
|
||||
quester.sendMessage(ChatColor.GRAY + "- " + s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1444,9 +1444,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
}
|
||||
}
|
||||
if ((available.size() + rows) <= (page * rows) || available.size() == 0) {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "pageNotExist"));
|
||||
quester.sendMessage(ChatColor.YELLOW + Lang.get(player, "pageNotExist"));
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questListTitle"));
|
||||
quester.sendMessage(ChatColor.GOLD + Lang.get(player, "questListTitle"));
|
||||
int fromOrder = (page - 1) * rows;
|
||||
List<Quest> subQuests;
|
||||
if (available.size() >= (fromOrder + rows)) {
|
||||
@ -1457,9 +1457,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
fromOrder++;
|
||||
for (final Quest q : subQuests) {
|
||||
if (quester.canAcceptOffer(q, false)) {
|
||||
player.sendMessage(ChatColor.YELLOW + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
quester.sendMessage(ChatColor.YELLOW + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GRAY + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
quester.sendMessage(ChatColor.GRAY + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
}
|
||||
fromOrder++;
|
||||
}
|
||||
@ -1467,13 +1467,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
String msg = Lang.get(player, "pageFooter");
|
||||
msg = msg.replace("<current>", String.valueOf(page));
|
||||
msg = msg.replace("<all>", String.valueOf(numPages));
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
quester.sendMessage(ChatColor.GOLD + msg);
|
||||
}
|
||||
} else {
|
||||
if ((quests.size() + rows) <= (page * rows) || quests.size() == 0) {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "pageNotExist"));
|
||||
quester.sendMessage(ChatColor.YELLOW + Lang.get(player, "pageNotExist"));
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questListTitle"));
|
||||
quester.sendMessage(ChatColor.GOLD + Lang.get(player, "questListTitle"));
|
||||
int fromOrder = (page - 1) * rows;
|
||||
List<Quest> subQuests;
|
||||
if (quests.size() >= (fromOrder + rows)) {
|
||||
@ -1484,9 +1484,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
fromOrder++;
|
||||
for (final Quest q : subQuests) {
|
||||
if (quester.canAcceptOffer(q, false)) {
|
||||
player.sendMessage(ChatColor.YELLOW + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
quester.sendMessage(ChatColor.YELLOW + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
} else {
|
||||
player.sendMessage(ChatColor.GRAY + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
quester.sendMessage(ChatColor.GRAY + Integer.toString(fromOrder) + ". " + q.getName());
|
||||
}
|
||||
fromOrder++;
|
||||
}
|
||||
@ -1494,7 +1494,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
||||
String msg = Lang.get(player, "pageFooter");
|
||||
msg = msg.replace("<current>", String.valueOf(page));
|
||||
msg = msg.replace("<all>", String.valueOf(numPages));
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
quester.sendMessage(ChatColor.GOLD + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,9 +204,9 @@ public class CmdExecutor implements CommandExecutor {
|
||||
final Stage stage = quester.getCurrentStage(q);
|
||||
q.updateCompass(quester, stage);
|
||||
if (plugin.getQuester(player.getUniqueId()).getQuestData(q).getDelayStartTime() == 0) {
|
||||
String msg = Lang.get(player, "questObjectivesTitle");
|
||||
msg = msg.replace("<quest>", q.getName());
|
||||
player.sendMessage(ChatColor.GOLD + msg);
|
||||
final String msg = Lang.get(player, "questCommandTitle")
|
||||
.replace("<quest>", q.getName());
|
||||
quester.sendMessage(ChatColor.GOLD + msg);
|
||||
plugin.showObjectives(q, quester, false);
|
||||
} else {
|
||||
final long time = plugin.getQuester(player.getUniqueId()).getStageTime(q);
|
||||
@ -214,11 +214,11 @@ public class CmdExecutor implements CommandExecutor {
|
||||
+ Lang.get(player, "plnTooEarly");
|
||||
msg = msg.replace("<quest>", q.getName());
|
||||
msg = msg.replace("<time>", MiscUtil.getTime(time));
|
||||
player.sendMessage(msg);
|
||||
quester.sendMessage(msg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest"));
|
||||
quester.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest"));
|
||||
}
|
||||
} else {
|
||||
showQuestDetails(cs, args);
|
||||
|
@ -569,7 +569,7 @@ overrideCreateSet: "Set details list override"
|
||||
overrideCreateEnter: "Enter replacement text, <clear>, <cancel>"
|
||||
questObjectivesTitle: "---(<quest>)---"
|
||||
questCompleteTitle: '**QUEST COMPLETE: <quest>**'
|
||||
questRewardsTitle: "Rewards:"
|
||||
questRewardsTitle: "Rewards"
|
||||
questFailed: "*QUEST FAILED*"
|
||||
questMaxAllowed: "You may only have up to <number> quests."
|
||||
questAlreadyOn: "You are already on that quest!"
|
||||
|
Loading…
Reference in New Issue
Block a user