NEW add limited PlaceholderAPI support. Bump version number

This commit is contained in:
HappyPikachu 2018-02-05 17:57:30 -05:00
parent b55ad6930c
commit 5aa81ca378
11 changed files with 219 additions and 185 deletions

12
pom.xml
View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>3.2.3</version>
<version>3.2.4</version>
<name>quests</name>
<url>https://github.com/FlyingPikachu/Quests/</url>
<packaging>jar</packaging>
@ -25,6 +25,10 @@
<id>sk89q-repo</id>
<url>http://maven.sk89q.com/repo/</url>
</repository>
<repository>
<id>placeholderapi</id>
<url>http://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>
</repositories>
<dependencies>
<dependency>
@ -149,6 +153,12 @@
<version>LATEST</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.8.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>

View File

@ -252,7 +252,7 @@ public class Event {
quest.failQuest(quester);
}
if (timer > 0) {
player.sendMessage(Lang.get("timerStart").replaceAll("<time>", String.valueOf(timer)));
player.sendMessage(Lang.get(player, "timerStart").replaceAll("<time>", String.valueOf(timer)));
if (timer > 60) {
quester.timers.put(new ObjectiveTimer(plugin, quester, quest, 60, false)
.runTaskLaterAsynchronously(plugin, (timer-60)*20).getTaskId(), quest);

View File

@ -86,7 +86,7 @@ public class NpcListener implements Listener {
text += (hand.getItemMeta().hasDisplayName() ? ")" : "");
}
text += " x " + ChatColor.DARK_AQUA + hand.getAmount() + ChatColor.GRAY;
evt.getClicker().sendMessage(Lang.get("questInvalidDeliveryItem").replaceAll("<item>", text));
evt.getClicker().sendMessage(Lang.get(player, "questInvalidDeliveryItem").replaceAll("<item>", text));
break;
}
}
@ -139,18 +139,18 @@ public class NpcListener implements Listener {
}
plugin.conversationFactory.buildConversation(player).begin();
} else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get("questMaxAllowed");
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg);
}
} else if (quester.currentQuests.size() < Quests.maxQuests || Quests.maxQuests < 1) {
if (quester.getDifference(q) > 0) {
String early = Lang.get("questTooEarly");
String early = Lang.get(player, "questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
} else if (q.redoDelay < 0) {
String completed = Lang.get("questAlreadyCompleted");
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
@ -162,12 +162,12 @@ public class NpcListener implements Listener {
plugin.conversationFactory.buildConversation(player).begin();
}
} else if (quester.currentQuests.containsKey(q) == false) {
String msg = Lang.get("questMaxAllowed");
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg);
}
} else if (npcQuests.isEmpty()) {
evt.getClicker().sendMessage(ChatColor.YELLOW + Lang.get("noMoreQuest"));
evt.getClicker().sendMessage(ChatColor.YELLOW + Lang.get(player, "noMoreQuest"));
}
}
}

View File

@ -39,7 +39,7 @@ public class ObjectiveTimer extends BukkitRunnable {
quest.failQuest(quester);
quester.updateJournal();
} else {
quester.getPlayer().sendMessage(Lang.get("timerMessage").replaceAll("<time>", String.valueOf(time)));
quester.getPlayer().sendMessage(Lang.get(quester.getPlayer(), "timerMessage").replaceAll("<time>", String.valueOf(time)));
}
}
}

View File

@ -102,25 +102,25 @@ public class PlayerListener implements Listener {
}
Quester quester = plugin.getQuester(evt.getWhoClicked().getUniqueId());
Player player = (Player) evt.getWhoClicked();
if (evt.getInventory().getTitle().contains(Lang.get("quests"))) {
if (evt.getInventory().getTitle().contains(Lang.get(player, "quests"))) {
ItemStack clicked = evt.getCurrentItem();
if (clicked != null) {
for (Quest quest : plugin.quests) {
if (quest.guiDisplay != null) {
if (ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) {
String msg = Lang.get("questMaxAllowed");
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg);
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
String completed = Lang.get("questAlreadyCompleted");
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
boolean takeable = true;
if (quester.completedQuests.contains(quest.name)) {
if (quester.getDifference(quest) > 0) {
String early = Lang.get("questTooEarly");
String early = Lang.get(player, "questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(quest)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
@ -140,7 +140,7 @@ public class PlayerListener implements Listener {
}
}
if (inRegion == false) {
String invalidLoc = Lang.get("questInvalidLocation");
String invalidLoc = Lang.get(player, "questInvalidLocation");
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + invalidLoc);
takeable = false;
@ -201,60 +201,60 @@ public class PlayerListener implements Listener {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType()))+ ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType()))+ ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedKillLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer().getUniqueId())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedReachLocations.put(evt.getPlayer().getUniqueId(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get(player, "questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + ItemUtil.getName(new ItemStack(block.getType())) + ChatColor.GOLD + ")");
} else if (player.isConversing() == false) {
for (final Quest q : plugin.quests) {
if (q.blockStart != null) {
if (q.blockStart.equals(evt.getClickedBlock().getLocation())) {
if (quester.currentQuests.size() >= Quests.maxQuests && Quests.maxQuests > 0) {
String msg = Lang.get("questMaxAllowed");
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(Quests.maxQuests));
player.sendMessage(ChatColor.YELLOW + msg);
} else {
if (quester.completedQuests.contains(q.name)) {
if (q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
String early = Lang.get("questTooEarly");
String early = Lang.get(player, "questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
return;
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
String completed = Lang.get("questAlreadyCompleted");
String completed = Lang.get(player, "questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
return;
@ -283,7 +283,7 @@ public class PlayerListener implements Listener {
if (evt.getRightClicked().getType() == EntityType.ITEM_FRAME) {
if (ItemUtil.isJournal(evt.getPlayer().getItemInHand())) {
evt.setCancelled(true);
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get("journalDenied"));
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "journalDenied"));
}
}
}

View File

@ -151,7 +151,7 @@ public class Quest {
nextStage.startEvent.fire(quester, this);
}
updateCompass(quester, nextStage);
String msg = Lang.get("questObjectivesTitle");
String msg = Lang.get(quester.getPlayer(), "questObjectivesTitle");
msg = msg.replaceAll("<quest>", name);
quester.getPlayer().sendMessage(ChatColor.GOLD + msg);
for (String s : quester.getObjectivesReal(this)) {
@ -278,7 +278,7 @@ public class Quest {
if (!q.completedQuests.contains(name)) {
q.completedQuests.add(name);
}
String none = ChatColor.GRAY + "- (" + Lang.get("none") + ")";
String none = ChatColor.GRAY + "- (" + Lang.get(player, "none") + ")";
final String ps = Quests.parseString(finished, this);
for (Map.Entry<Integer, Quest> entry : q.timers.entrySet()) {
if (entry.getValue().getName().equals(getName())) {
@ -362,18 +362,18 @@ public class Quest {
player.giveExp(exp);
none = null;
}
String complete = Lang.get("questCompleteTitle");
String complete = Lang.get(player, "questCompleteTitle");
complete = complete.replaceAll("<quest>", ChatColor.YELLOW + name + ChatColor.GOLD);
player.sendMessage(ChatColor.GOLD + complete);
player.sendMessage(ChatColor.GREEN + Lang.get("questRewardsTitle"));
player.sendMessage(ChatColor.GREEN + Lang.get(player, "questRewardsTitle"));
if (plugin.showQuestTitles) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
+ " title " + "{\"text\":\"" + Lang.get("quest") + " " + Lang.get("complete") + "\",\"color\":\"gold\"}");
+ " title " + "{\"text\":\"" + Lang.get(player, "quest") + " " + Lang.get(player, "complete") + "\",\"color\":\"gold\"}");
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
+ " subtitle " + "{\"text\":\"" + name + "\",\"color\":\"yellow\"}");
}
if (questPoints > 0) {
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " " + Lang.get("questPoints"));
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " " + Lang.get(player, "questPoints"));
q.questPoints += questPoints;
none = null;
}
@ -383,7 +383,7 @@ public class Quest {
if (i.getEnchantments().isEmpty()) {
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount();
} else {
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " " + Lang.get("with")
text = "- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " " + Lang.get(player, "with")
+ ChatColor.DARK_PURPLE;
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
@ -394,7 +394,7 @@ public class Quest {
if (i.getEnchantments().isEmpty()) {
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount();
} else {
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " " + Lang.get("with");
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " " + Lang.get(player, "with");
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
@ -404,7 +404,7 @@ public class Quest {
if (i.getEnchantments().isEmpty()) {
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount();
} else {
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " " + Lang.get("with");
text = "- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " " + Lang.get(player, "with");
for (Entry<Enchantment, Integer> e : i.getEnchantments().entrySet()) {
text += " " + Quester.prettyEnchantmentString(e.getKey()) + ":" + e.getValue();
}
@ -419,19 +419,19 @@ public class Quest {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
}
} else if (i.getDurability() != 0) {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
}
} else {
if (i.getEnchantments().isEmpty()) {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount());
} else {
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
player.sendMessage("- " + ChatColor.DARK_GREEN + ItemUtil.getName(i) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get(player, "enchantedItem"));
}
}
none = null;
@ -445,18 +445,18 @@ public class Quest {
}
if (exp > 0 || phatLootExp > 0) {
int tot = exp + phatLootExp;
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " + Lang.get("experience"));
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " + Lang.get(player, "experience"));
none = null;
}
if (mcmmoSkills.isEmpty() == false) {
for (String s : mcmmoSkills) {
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " " + Lang.get("experience"));
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " " + Lang.get(player, "experience"));
}
none = null;
}
if (heroesClasses.isEmpty() == false) {
for (String s : heroesClasses) {
player.sendMessage("- " + ChatColor.AQUA + heroesAmounts.get(heroesClasses.indexOf(s)) + " " + ChatColor.BLUE + s + " " + Lang.get("experience"));
player.sendMessage("- " + ChatColor.AQUA + heroesAmounts.get(heroesClasses.indexOf(s)) + " " + ChatColor.BLUE + s + " " + Lang.get(player, "experience"));
}
none = null;
}
@ -503,10 +503,10 @@ public class Quest {
@SuppressWarnings("deprecation")
public void failQuest(Quester q) {
Player player = plugin.getServer().getPlayer(q.id);
String title = Lang.get("questTitle");
String title = Lang.get(player, "questTitle");
title = title.replaceAll("<quest>", ChatColor.DARK_PURPLE + name + ChatColor.AQUA);
player.sendMessage(ChatColor.AQUA + title);
player.sendMessage(ChatColor.RED + Lang.get("questFailed"));
player.sendMessage(ChatColor.RED + Lang.get(player, "questFailed"));
q.hardQuit(this);
q.saveData();
player.updateInventory();

View File

@ -244,12 +244,12 @@ public class Quester {
if (index != -1) {
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1);
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(ChatColor.LIGHT_PURPLE + Lang.get("journalTitle"));
meta.setDisplayName(ChatColor.LIGHT_PURPLE + Lang.get(getPlayer(), "journalTitle"));
BookMeta book = (BookMeta) meta;
book.setTitle(ChatColor.LIGHT_PURPLE + Lang.get("journalTitle"));
book.setTitle(ChatColor.LIGHT_PURPLE + Lang.get(getPlayer(), "journalTitle"));
book.setAuthor(getPlayer().getName());
if (currentQuests.isEmpty()) {
book.addPage(ChatColor.DARK_RED + Lang.get("journalNoQuests"));
book.addPage(ChatColor.DARK_RED + Lang.get(getPlayer(), "journalNoQuests"));
} else {
int currentLength = 0;
int currentLines = 0;
@ -326,18 +326,18 @@ public class Quester {
Quests.removeItem(player.getInventory(), is);
}
}
String accepted = Lang.get("questAccepted");
String accepted = Lang.get(getPlayer(), "questAccepted");
accepted = accepted.replaceAll("<quest>", q.name);
player.sendMessage(ChatColor.GREEN + accepted);
player.sendMessage("");
if (plugin.showQuestTitles) {
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
+ " title " + "{\"text\":\"" + Lang.get("quest") + " " + Lang.get("accepted") + "\",\"color\":\"gold\"}");
+ " title " + "{\"text\":\"" + Lang.get(getPlayer(), "quest") + " " + Lang.get(getPlayer(), "accepted") + "\",\"color\":\"gold\"}");
Bukkit.getServer().dispatchCommand(Bukkit.getServer().getConsoleSender(), "title " + player.getName()
+ " subtitle " + "{\"text\":\"" + q.name + "\",\"color\":\"yellow\"}");
}
}
String msg = Lang.get("questObjectivesTitle");
String msg = Lang.get(getPlayer(), "questObjectivesTitle");
msg = msg.replaceAll("<quest>", q.name);
getPlayer().sendMessage(ChatColor.GOLD + msg);
for (String s : getObjectivesReal(q)) {
@ -390,9 +390,9 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksBroken) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "break") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
}
}
}
@ -401,9 +401,9 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksDamaged) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "damage") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
}
}
}
@ -412,9 +412,9 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksPlaced) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("place") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "place") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("place") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "place") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
}
}
}
@ -423,9 +423,9 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksUsed) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("use") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "use") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("use") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "use") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
}
}
}
@ -434,18 +434,18 @@ public class Quester {
for (ItemStack e2 : getQuestData(quest).blocksCut) {
if (e2.getType().equals(e.getType()) && e2.getDurability() == e.getDurability()) {
if (e2.getAmount() < e.getAmount()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("cut") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "cut") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GREEN + ": " + e2.getAmount() + "/" + e.getAmount());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("cut") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "cut") + " " + Items.itemByType(e2.getType()).getName() + ChatColor.GRAY + ": " + e2.getAmount() + "/" + e.getAmount());
}
}
}
}
if (getCurrentStage(quest).fishToCatch != null) {
if (getQuestData(quest).getFishCaught() < getCurrentStage(quest).fishToCatch) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("catchFish") + ChatColor.GREEN + ": " + getQuestData(quest).getFishCaught() + "/" + getCurrentStage(quest).fishToCatch);
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "catchFish") + ChatColor.GREEN + ": " + getQuestData(quest).getFishCaught() + "/" + getCurrentStage(quest).fishToCatch);
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("catchFish") + ChatColor.GRAY + ": " + getQuestData(quest).getFishCaught() + "/" + getCurrentStage(quest).fishToCatch);
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "catchFish") + ChatColor.GRAY + ": " + getQuestData(quest).getFishCaught() + "/" + getCurrentStage(quest).fishToCatch);
}
}
Map<Enchantment, Material> set;
@ -478,12 +478,12 @@ public class Quester {
}
if (enchantment2 == enchantment) {
if (num1 < num2) {
String obj = Lang.get("enchantItem");
String obj = Lang.get(getPlayer(), "enchantItem");
obj = obj.replaceAll("<item>", ItemUtil.getName(new ItemStack(mat)));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + num1 + "/" + num2);
} else {
String obj = Lang.get("enchantItem");
String obj = Lang.get(getPlayer(), "enchantItem");
obj = obj.replaceAll("<item>", ItemUtil.getName(new ItemStack(mat)));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + num1 + "/" + num2);
@ -497,18 +497,18 @@ public class Quester {
if (getQuestData(quest).mobNumKilled.size() > getQuestData(quest).mobsKilled.indexOf(e2) && getCurrentStage(quest).mobNumToKill.size() > getCurrentStage(quest).mobsToKill.indexOf(e)) {
if (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2)) < getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))) {
if (getCurrentStage(quest).locationsToKillWithin.isEmpty()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("kill") + " " + Quester.prettyMobString(e) + ChatColor.GREEN + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "kill") + " " + Quester.prettyMobString(e) + ChatColor.GREEN + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
} else {
String obj = Lang.get("killAtLocation");
String obj = Lang.get(getPlayer(), "killAtLocation");
obj = obj.replaceAll("<mob>", Quester.prettyMobString(e));
obj = obj.replaceAll("<location>", getCurrentStage(quest).areaNames.get(getCurrentStage(quest).mobsToKill.indexOf(e)));
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
}
} else {
if (getCurrentStage(quest).locationsToKillWithin.isEmpty()) {
finishedObjectives.add(ChatColor.GRAY + Lang.get("kill") + " " + Quester.prettyMobString(e) + ChatColor.GRAY + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "kill") + " " + Quester.prettyMobString(e) + ChatColor.GRAY + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
} else {
String obj = Lang.get("killAtLocation");
String obj = Lang.get(getPlayer(), "killAtLocation");
obj = obj.replaceAll("<mob>", Quester.prettyMobString(e));
obj = obj.replaceAll("<location>", getCurrentStage(quest).areaNames.get(getCurrentStage(quest).mobsToKill.indexOf(e)));
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + (getQuestData(quest).mobNumKilled.get(getQuestData(quest).mobsKilled.indexOf(e2))) + "/" + (getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(e))));
@ -520,9 +520,9 @@ public class Quester {
}
if (getCurrentStage(quest).playersToKill != null) {
if (getQuestData(quest).getPlayersKilled() < getCurrentStage(quest).playersToKill) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("killPlayer") + ChatColor.GREEN + ": " + getQuestData(quest).getPlayersKilled() + "/" + getCurrentStage(quest).playersToKill);
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "killPlayer") + ChatColor.GREEN + ": " + getQuestData(quest).getPlayersKilled() + "/" + getCurrentStage(quest).playersToKill);
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("killPlayer") + ChatColor.GRAY + ": " + getQuestData(quest).getPlayersKilled() + "/" + getCurrentStage(quest).playersToKill);
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "killPlayer") + ChatColor.GRAY + ": " + getQuestData(quest).getPlayersKilled() + "/" + getCurrentStage(quest).playersToKill);
}
}
int index2 = 0;
@ -532,12 +532,12 @@ public class Quester {
Integer npc = getCurrentStage(quest).itemDeliveryTargets.get(index2);
index2++;
if (delivered < amt) {
String obj = Lang.get("deliver");
String obj = Lang.get(getPlayer(), "deliver");
obj = obj.replaceAll("<item>", ItemUtil.getName(is));
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc));
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + delivered + "/" + amt);
} else {
String obj = Lang.get("deliver");
String obj = Lang.get(getPlayer(), "deliver");
obj = obj.replaceAll("<item>", ItemUtil.getName(is));
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc));
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + delivered + "/" + amt);
@ -547,11 +547,11 @@ public class Quester {
for (Entry<Integer, Boolean> e : getQuestData(quest).citizensInteracted.entrySet()) {
if (e.getKey().equals(n)) {
if (e.getValue() == false) {
String obj = Lang.get("talkTo");
String obj = Lang.get(getPlayer(), "talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(n));
unfinishedObjectives.add(ChatColor.GREEN + obj);
} else {
String obj = Lang.get("talkTo");
String obj = Lang.get(getPlayer(), "talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(n));
finishedObjectives.add(ChatColor.GRAY + obj);
}
@ -563,9 +563,9 @@ public class Quester {
if (n.equals(n2)) {
if (getQuestData(quest).citizenNumKilled.size() > getQuestData(quest).citizensKilled.indexOf(n2) && getCurrentStage(quest).citizenNumToKill.size() > getCurrentStage(quest).citizensToKill.indexOf(n)) {
if (getQuestData(quest).citizenNumKilled.get(getQuestData(quest).citizensKilled.indexOf(n2)) < getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n))) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("kill") + " " + plugin.getNPCName(n) + ChatColor.GREEN + " " + getQuestData(quest).citizenNumKilled.get(getCurrentStage(quest).citizensToKill.indexOf(n)) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)));
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "kill") + " " + plugin.getNPCName(n) + ChatColor.GREEN + " " + getQuestData(quest).citizenNumKilled.get(getCurrentStage(quest).citizensToKill.indexOf(n)) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)));
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("kill") + " " + plugin.getNPCName(n) + ChatColor.GRAY + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)));
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "kill") + " " + plugin.getNPCName(n) + ChatColor.GRAY + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(n)));
}
}
}
@ -575,9 +575,9 @@ public class Quester {
for (Entry<EntityType, Integer> e2 : getQuestData(quest).mobsTamed.entrySet()) {
if (e.getKey().equals(e2.getKey())) {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("tame") + " " + getCapitalized(e.getKey().name()) + ChatColor.GREEN + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get(getPlayer(), "tame") + " " + getCapitalized(e.getKey().name()) + ChatColor.GREEN + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + Lang.get("tame") + " " + getCapitalized(e.getKey().name()) + ChatColor.GRAY + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get(getPlayer(), "tame") + " " + getCapitalized(e.getKey().name()) + ChatColor.GRAY + ": " + e2.getValue() + "/" + e.getValue());
}
}
}
@ -586,11 +586,11 @@ public class Quester {
for (Entry<DyeColor, Integer> e2 : getQuestData(quest).sheepSheared.entrySet()) {
if (e.getKey().equals(e2.getKey())) {
if (e2.getValue() < e.getValue()) {
String obj = Lang.get("shearSheep");
String obj = Lang.get(getPlayer(), "shearSheep");
obj = obj.replaceAll("<color>", e.getKey().name().toLowerCase());
unfinishedObjectives.add(ChatColor.GREEN + obj + ChatColor.GREEN + ": " + e2.getValue() + "/" + e.getValue());
} else {
String obj = Lang.get("shearSheep");
String obj = Lang.get(getPlayer(), "shearSheep");
obj = obj.replaceAll("<color>", e.getKey().name().toLowerCase());
finishedObjectives.add(ChatColor.GRAY + obj + ChatColor.GRAY + ": " + e2.getValue() + "/" + e.getValue());
}
@ -602,11 +602,11 @@ public class Quester {
if (l.equals(l2)) {
if (!getQuestData(quest).hasReached.isEmpty()) {
if (getQuestData(quest).hasReached.get(getQuestData(quest).locationsReached.indexOf(l2)) == false) {
String obj = Lang.get("goTo");
String obj = Lang.get(getPlayer(), "goTo");
obj = obj.replaceAll("<location>", getCurrentStage(quest).locationNames.get(getCurrentStage(quest).locationsToReach.indexOf(l)));
unfinishedObjectives.add(ChatColor.GREEN + obj);
} else {
String obj = Lang.get("goTo");
String obj = Lang.get(getPlayer(), "goTo");
obj = obj.replaceAll("<location>", getCurrentStage(quest).locationNames.get(getCurrentStage(quest).locationsToReach.indexOf(l)));
finishedObjectives.add(ChatColor.GRAY + obj);
}
@ -1150,20 +1150,20 @@ public class Quester {
Player p = getPlayer();
if (getCurrentStage(quest).objectiveOverride != null) {
if (testComplete(quest)) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + getCurrentStage(quest).objectiveOverride;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + getCurrentStage(quest).objectiveOverride;
p.sendMessage(message);
quest.nextStage(this);
}
return;
}
if (objective.equalsIgnoreCase("password")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + pass;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + pass;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("breakBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + ItemUtil.getName(material);
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "break") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksBroken.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1172,7 +1172,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("damageBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + ItemUtil.getName(material);
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "damage") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksDamaged.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1180,7 +1180,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("placeBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + ItemUtil.getName(material);
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "place") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksPlaced.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1189,7 +1189,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("useBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + ItemUtil.getName(material);
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "use") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksUsed.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1198,7 +1198,7 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("cutBlock")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + ItemUtil.getName(material);
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "cut") + " " + ItemUtil.getName(material);
String stack = getQuestData(quest).blocksCut.toString();
String amount = stack.substring(stack.lastIndexOf(" x ") + 3).replace("}]", "");
message = message + " " + amount + "/" + amount;
@ -1207,17 +1207,17 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("catchFish")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("catchFish") + " ";
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "catchFish") + " ";
message = message + " " + getCurrentStage(quest).fishToCatch + "/" + getCurrentStage(quest).fishToCatch;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("enchantItem")) {
String obj = Lang.get("enchantItem");
String obj = Lang.get(p, "enchantItem");
obj = obj.replaceAll("<item>", ItemUtil.getName(material));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
for (Map<Enchantment, Material> map : getCurrentStage(quest).itemsToEnchant.keySet()) {
if (map.containsKey(enchantment)) {
message = message + " " + getCurrentStage(quest).itemsToEnchant.get(map) + "/" + getCurrentStage(quest).itemsToEnchant.get(map);
@ -1229,69 +1229,69 @@ public class Quester {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("deliverItem")) {
String obj = Lang.get("deliver");
String obj = Lang.get(p, "deliver");
obj = obj.replaceAll("<item>", ItemUtil.getString(getCurrentStage(quest).itemsToDeliver.get(getCurrentStage(quest).itemsToDeliver.indexOf(delivery))));
obj = obj.replaceAll("<npc>", plugin.getNPCName(getCurrentStage(quest).itemDeliveryTargets.get(getCurrentStage(quest).itemsToDeliver.indexOf(delivery))));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("killMob")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + " " + mob.name();
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " " + mob.name();
message = message + " " + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob)) + "/" + getCurrentStage(quest).mobNumToKill.get(getCurrentStage(quest).mobsToKill.indexOf(mob));
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("killPlayer")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("killPlayer");
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "killPlayer");
message = message + " " + getCurrentStage(quest).playersToKill + "/" + getCurrentStage(quest).playersToKill;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("talkToNPC")) {
String obj = Lang.get("talkTo");
String obj = Lang.get(p, "talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc.getId()));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("killNPC")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + " " + npc.getName();
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "kill") + " " + npc.getName();
message = message + " " + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId())) + "/" + getCurrentStage(quest).citizenNumToKill.get(getCurrentStage(quest).citizensToKill.indexOf(npc.getId()));
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("tameMob")) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("tame") + " " + getCapitalized(mob.name());
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + Lang.get(p, "tame") + " " + getCapitalized(mob.name());
message = message + " " + getCurrentStage(quest).mobsToTame.get(mob) + "/" + getCurrentStage(quest).mobsToTame.get(mob);
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("shearSheep")) {
String obj = Lang.get("shearSheep");
String obj = Lang.get(p, "shearSheep");
obj = obj.replaceAll("<color>", color.name().toLowerCase());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
message = message + " " + getCurrentStage(quest).sheepToShear.get(color) + "/" + getCurrentStage(quest).sheepToShear.get(color);
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (objective.equalsIgnoreCase("reachLocation")) {
String obj = Lang.get("goTo");
String obj = Lang.get(p, "goTo");
obj = obj.replaceAll("<location>", getCurrentStage(quest).locationNames.get(getCurrentStage(quest).locationsToReach.indexOf(location)));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + obj;
p.sendMessage(message);
if (testComplete(quest)) {
quest.nextStage(this);
}
} else if (co != null) {
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + co.getDisplay();
String message = ChatColor.GREEN + "(" + Lang.get(p, "completed") + ") " + co.getDisplay();
int index = -1;
for (int i = 0; i < getCurrentStage(quest).customObjectives.size(); i++) {
if (getCurrentStage(quest).customObjectives.get(i).getName().equals(co.getName())) {
@ -2485,7 +2485,7 @@ public class Quester {
public void showGUIDisplay(NPC npc, LinkedList<Quest> quests) {
Player player = getPlayer();
int size = ((quests.size() / 9) + 1) * 9;
Inventory inv = Bukkit.getServer().createInventory(player, size, Lang.get("quests") + " | " + npc.getName());
Inventory inv = Bukkit.getServer().createInventory(player, size, Lang.get(player, "quests") + " | " + npc.getName());
int inc = 0;
for (int i = 0; i < quests.size(); i++) {
if (quests.get(i).guiDisplay != null) {
@ -2493,7 +2493,7 @@ public class Quester {
ItemMeta meta = display.getItemMeta();
if (completedQuests.contains(quests.get(i).name)) {
meta.setDisplayName(ChatColor.DARK_PURPLE + Quests.parseString(quests.get(i).getName()
+ " " + ChatColor.GREEN + Lang.get("redoCompleted"), npc));
+ " " + ChatColor.GREEN + Lang.get(player, "redoCompleted"), npc));
} else {
meta.setDisplayName(ChatColor.DARK_PURPLE + Quests.parseString(quests.get(i).getName(), npc));
}

View File

@ -94,6 +94,7 @@ import me.blackvein.quests.prompts.QuestAcceptPrompt;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.MiscUtil;
import me.clip.placeholderapi.PlaceholderAPIPlugin;
import net.aufdemrand.denizen.Denizen;
import net.aufdemrand.denizencore.scripts.ScriptRegistry;
import net.citizensnpcs.api.CitizensAPI;
@ -111,6 +112,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public static mcMMO mcmmo = null;
public static Heroes heroes = null;
public static PhatLoots phatLoots = null;
public static PlaceholderAPIPlugin placeholder = null;
public static boolean npcEffects = true;
public static boolean useCompass = true;
public static boolean ignoreLockedQuests = false;
@ -386,6 +388,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (getServer().getPluginManager().getPlugin("PhatLoots") != null) {
phatLoots = (PhatLoots) getServer().getPluginManager().getPlugin("PhatLoots");
}
if (getServer().getPluginManager().getPlugin("PlaceholderAPI") != null) {
placeholder = (PlaceholderAPIPlugin) getServer().getPluginManager().getPlugin("PlaceholderAPI");
}
if (!setupEconomy()) {
getLogger().warning("Economy not found.");
}
@ -416,7 +421,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (abandonedEvent.gracefulExit() == false) {
if (abandonedEvent.getContext().getForWhom() != null) {
try {
abandonedEvent.getContext().getForWhom().sendRawMessage(ChatColor.YELLOW + Lang.get("questTimeout"));
abandonedEvent.getContext().getForWhom().sendRawMessage(ChatColor.YELLOW
+ Lang.get((Player) abandonedEvent.getContext().getForWhom(), "questTimeout"));
} catch (Exception e) {
}
}
@ -431,36 +437,26 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
@Override
public String getPromptText(ConversationContext context) {
/*if (!askConfirmation) {
Player player = (Player) context.getForWhom();
getQuester(player.getUniqueId()).takeQuest(getQuest(getQuester(player.getUniqueId()).questToTake), false);
return "";
} else {*/
return ChatColor.YELLOW + Lang.get("acceptQuest") + " " + ChatColor.GREEN + Lang.get("yesWord") + " / " + Lang.get("noWord");
//}
return ChatColor.YELLOW + Lang.get((Player) context.getForWhom(), "acceptQuest") + " " + ChatColor.GREEN + Lang.get("yesWord") + " / " + Lang.get("noWord");
}
@Override
public Prompt acceptInput(ConversationContext context, String s) {
/*if (!askConfirmation) {
return Prompt.END_OF_CONVERSATION;
} else {*/
Player player = (Player) context.getForWhom();
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
try {
getQuester(player.getUniqueId()).takeQuest(getQuest(getQuester(player.getUniqueId()).questToTake), false);
} catch (Exception e) {
e.printStackTrace();
}
return Prompt.END_OF_CONVERSATION;
} else if (s.equalsIgnoreCase(Lang.get("noWord"))) {
player.sendMessage(ChatColor.YELLOW + Lang.get("cancelled"));
return Prompt.END_OF_CONVERSATION;
} else {
player.sendMessage(ChatColor.RED + Lang.get("questInvalidChoice"));
return new QuestPrompt();
Player player = (Player) context.getForWhom();
if (s.equalsIgnoreCase(Lang.get(player, "yesWord"))) {
try {
getQuester(player.getUniqueId()).takeQuest(getQuest(getQuester(player.getUniqueId()).questToTake), false);
} catch (Exception e) {
e.printStackTrace();
}
//}
return Prompt.END_OF_CONVERSATION;
} else if (s.equalsIgnoreCase(Lang.get("noWord"))) {
player.sendMessage(ChatColor.YELLOW + Lang.get("cancelled"));
return Prompt.END_OF_CONVERSATION;
} else {
player.sendMessage(ChatColor.RED + Lang.get("questInvalidChoice"));
return new QuestPrompt();
}
}
}
@ -599,41 +595,41 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
public void printHelp(Player player) {
player.sendMessage(ChatColor.GOLD + Lang.get("questHelpTitle"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("questDisplayHelp"));
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questHelpTitle"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "questDisplayHelp"));
if (player.hasPermission("quests.list")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_LIST_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_LIST_HELP"));
}
if (player.hasPermission("quests.take")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_TAKE_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TAKE_HELP"));
}
if (player.hasPermission("quests.quit")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_QUIT_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_QUIT_HELP"));
}
if (player.hasPermission("quests.journal")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_JOURNAL_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_JOURNAL_HELP"));
}
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_EDITOR_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EDITOR_HELP"));
}
if (player.hasPermission("quests.editor.*") || player.hasPermission("quests.editor.events.editor")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_EVENTS_EDITOR_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_EVENTS_EDITOR_HELP"));
}
if (player.hasPermission("quests.stats")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_STATS_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_STATS_HELP"));
}
if (player.hasPermission("quests.top")) {
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_TOP_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_TOP_HELP"));
}
// player.sendMessage(GOLD + "/quests party - Quest Party commands");
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get("COMMAND_INFO_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quests " + Lang.get(player, "COMMAND_INFO_HELP"));
player.sendMessage(" ");
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get("COMMAND_QUEST_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUEST_HELP"));
if (player.hasPermission("quests.questinfo")) {
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get("COMMAND_QUESTINFO_HELP"));
player.sendMessage(ChatColor.YELLOW + "/quest " + Lang.get(player, "COMMAND_QUESTINFO_HELP"));
}
if (player.hasPermission("quests.admin.*") || player.hasPermission("quests.admin")) {
player.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get("COMMAND_QUESTADMIN_HELP"));
player.sendMessage(ChatColor.DARK_RED + "/questadmin " + ChatColor.RED + Lang.get(player, "COMMAND_QUESTADMIN_HELP"));
}
}
@ -652,7 +648,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
public boolean onCommand(final CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
if (checkQuester(((Player) cs).getUniqueId()) == true) {
cs.sendMessage(ChatColor.RED + Lang.get("questBlacklisted"));
cs.sendMessage(ChatColor.RED + Lang.get((Player) cs, "questBlacklisted"));
return true;
}
}
@ -785,7 +781,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questPointsGiven");
String msg2 = Lang.get(target, "questPointsGiven");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -824,7 +820,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questPointsTaken");
String msg2 = Lang.get(target, "questPointsTaken");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -916,7 +912,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<quest>", ChatColor.DARK_PURPLE + questToGive.name + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questForcedTake");
String msg2 = Lang.get(target, "questForcedTake");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<quest>", ChatColor.DARK_PURPLE + questToGive.name + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -1027,7 +1023,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questForcedFinish");
String msg2 = Lang.get(target, "questForcedFinish");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -1051,7 +1047,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
if (target == null) {
//
for (Player p : getServer().getOnlinePlayers()) {
if (p.getName().toLowerCase().contains(args[1].toLowerCase())) {
target = p;
@ -1126,7 +1121,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questForcedNextStage");
String msg2 = Lang.get(target, "questForcedNextStage");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -1168,7 +1163,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
msg1 = msg1.replaceAll("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = Lang.get("questForcedQuit");
String msg2 = Lang.get(target, "questForcedQuit");
msg2 = msg2.replaceAll("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replaceAll("<quest>", ChatColor.DARK_PURPLE + found.name + ChatColor.GOLD);
target.sendMessage(ChatColor.GREEN + msg2);
@ -1476,7 +1471,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
}
player.sendMessage(ChatColor.YELLOW + Lang.get("journalPutAway"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalPutAway"));
quester.hasJournal = false;
} else if (player.getItemInHand() == null || player.getItemInHand().getType().equals(Material.AIR)) {
ItemStack stack = new ItemStack(Material.WRITTEN_BOOK, 1);
@ -1484,7 +1479,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
meta.setDisplayName(ChatColor.LIGHT_PURPLE + Lang.get("journalTitle"));
stack.setItemMeta(meta);
player.setItemInHand(stack);
player.sendMessage(ChatColor.YELLOW + Lang.get("journalTaken"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
quester.hasJournal = true;
quester.updateJournal();
} else {
@ -1498,7 +1493,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
meta.setDisplayName(ChatColor.LIGHT_PURPLE + Lang.get("journalTitle"));
stack.setItemMeta(meta);
inv.setItem(i, stack);
player.sendMessage(ChatColor.YELLOW + Lang.get("journalTaken"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalTaken"));
given = true;
break;
}
@ -1507,7 +1502,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
quester.hasJournal = true;
quester.updateJournal();
} else
player.sendMessage(ChatColor.YELLOW + Lang.get("journalNoRoom"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "journalNoRoom"));
}
}
@ -1515,14 +1510,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (allowQuitting == true) {
if (((Player) player).hasPermission("quests.quit")) {
if (args.length == 1) {
player.sendMessage(ChatColor.RED + Lang.get("COMMAND_QUIT_HELP"));
player.sendMessage(ChatColor.RED + Lang.get(player, "COMMAND_QUIT_HELP"));
return true;
}
Quester quester = getQuester(player.getUniqueId());
if (quester.currentQuests.isEmpty() == false) {
Quest found = findQuest(MiscUtil.concatArgArray(args, 1, args.length - 1, ' '));
if (found == null) {
player.sendMessage(ChatColor.RED + Lang.get("questNotFound"));
player.sendMessage(ChatColor.RED + Lang.get(player, "questNotFound"));
return true;
}
quester.hardQuit(found);
@ -1534,15 +1529,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
quester.updateJournal();
return true;
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("noActiveQuest"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest"));
return true;
}
} else {
player.sendMessage(ChatColor.RED + Lang.get("questQuitNoPerms"));
player.sendMessage(ChatColor.RED + Lang.get(player, "questQuitNoPerms"));
return true;
}
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("questQuitDisabled"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questQuitDisabled"));
return true;
}
}
@ -1551,7 +1546,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
if (allowCommands == true) {
if (((Player) player).hasPermission("quests.take")) {
if (args.length == 1) {
player.sendMessage(ChatColor.YELLOW + Lang.get("COMMAND_TAKE_USAGE"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "COMMAND_TAKE_USAGE"));
} else {
String name = null;
if (args.length == 2) {
@ -1583,29 +1578,29 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
final Quest q = questToFind;
final Quester quester = getQuester(player.getUniqueId());
if (quester.currentQuests.size() >= maxQuests && maxQuests > 0) {
String msg = Lang.get("questMaxAllowed");
String msg = Lang.get(player, "questMaxAllowed");
msg = msg.replaceAll("<number>", String.valueOf(maxQuests));
player.sendMessage(ChatColor.YELLOW + msg);
} else if (quester.currentQuests.containsKey(q)) {
String msg = Lang.get("questAlreadyOn");
String msg = Lang.get(player, "questAlreadyOn");
player.sendMessage(ChatColor.YELLOW + msg);
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
String msg = Lang.get("questAlreadyCompleted");
String msg = Lang.get(player, "questAlreadyCompleted");
msg = msg.replaceAll("<quest>", ChatColor.DARK_PURPLE + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + msg);
} else if (q.npcStart != null && allowCommandsForNpcQuests == false) {
String msg = Lang.get("mustSpeakTo");
String msg = Lang.get(player, "mustSpeakTo");
msg = msg.replaceAll("<npc>", ChatColor.DARK_PURPLE + q.npcStart.getName() + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + msg);
} else if (q.blockStart != null) {
String msg = Lang.get("noCommandStart");
String msg = Lang.get(player, "noCommandStart");
msg = msg.replaceAll("<quest>", ChatColor.DARK_PURPLE + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + msg);
} else {
boolean takeable = true;
if (quester.completedQuests.contains(q.name)) {
if (quester.getDifference(q) > 0) {
String early = Lang.get("questTooEarly");
String early = Lang.get(player, "questTooEarly");
early = early.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
early = early.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + early);
@ -1625,7 +1620,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
if (inRegion == false) {
String msg = Lang.get("questInvalidLocation");
String msg = Lang.get(player, "questInvalidLocation");
msg = msg.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + msg);
takeable = false;
@ -1645,21 +1640,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
conversationFactory.buildConversation((Conversable) player).begin();
}
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("alreadyConversing"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "alreadyConversing"));
}
} else {
}
}
}
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("questNotFound"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questNotFound"));
}
}
} else {
player.sendMessage(ChatColor.RED + Lang.get("questTakeNoPerms"));
player.sendMessage(ChatColor.RED + Lang.get(player, "questTakeNoPerms"));
}
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("questTakeDisabled"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "questTakeDisabled"));
}
}
@ -1860,7 +1855,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
q.updateCompass(quester, stage);
try {
if (getQuester(player.getUniqueId()).getQuestData(q).delayStartTime == 0) {
String msg = Lang.get("questObjectivesTitle");
String msg = Lang.get(player, "questObjectivesTitle");
msg = msg.replaceAll("<quest>", q.name);
player.sendMessage(ChatColor.GOLD + msg);
try {
@ -1877,7 +1872,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
}
} else {
player.sendMessage(ChatColor.YELLOW + Lang.get("noActiveQuest"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "noActiveQuest"));
}
}
@ -1951,12 +1946,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
public void listQuests(Player player, int page) {
int rows = 7;
if ((quests.size() + rows) < ((page * rows)) || quests.size() == 0) {
player.sendMessage(ChatColor.YELLOW + Lang.get("pageNotExist"));
player.sendMessage(ChatColor.YELLOW + Lang.get(player, "pageNotExist"));
} else {
player.sendMessage(ChatColor.GOLD + Lang.get("questListTitle"));
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questListTitle"));
int fromOrder = (page - 1) * rows;
List<Quest> subQuests;
@ -1975,7 +1969,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
}
int numPages = (int) Math.ceil(((double) quests.size()) / ((double) rows));
String msg = Lang.get("pageFooter");
String msg = Lang.get(player, "pageFooter");
msg = msg.replaceAll("<current>", String.valueOf(page));
msg = msg.replaceAll("<all>", String.valueOf(numPages));
player.sendMessage(ChatColor.GOLD + msg);

View File

@ -55,10 +55,10 @@ public class StageTimer implements Runnable {
quester.addEmptiesFor(quest, 0);
quester.getQuestData(quest).delayStartTime = 0;
quester.getQuestData(quest).delayTimeLeft = -1;
String msg = Lang.get("questObjectivesTitle");
String msg = Lang.get(player, "questObjectivesTitle");
msg = msg.replaceAll("<quest>", quest.name);
player.sendMessage(ChatColor.GOLD + msg);
player.sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
player.sendMessage(ChatColor.GOLD + Lang.get(player, "questObjectivesTitle"));
for (String s : quester.getObjectivesReal(quest)) {
player.sendMessage(s);
}

View File

@ -26,8 +26,10 @@ import org.bukkit.ChatColor;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import me.blackvein.quests.Quests;
import me.clip.placeholderapi.PlaceholderAPI;
public class Lang {
@ -41,6 +43,23 @@ public class Lang {
this.plugin = plugin;
}
/**
* Get lang string AND pass Player for use with PlaceholderAPI, if installed
*
* @param p the Player whom will receive the string
* @param key label as it appears in lang file, such as "journalNoQuests"
* @return formatted string, plus processing through PlaceholderAPI by clip
*/
public static String get(Player p, String key) {
return langMap.containsKey(key) ? tokens.convertString(p, langMap.get(key)) : "NULL";
}
/**
* Get lang string
*
* @param key label as it appears in lang file, such as "journalNoQuests"
* @return formatted string
*/
public static String get(String key) {
return langMap.containsKey(key) ? tokens.convertString(langMap.get(key)) : "NULL";
}
@ -212,5 +231,16 @@ public class Lang {
}
return s;
}
public String convertString(Player p, String s) {
for (String token : tokenMap.keySet()) {
s = s.replace(token, tokenMap.get(token));
s = s.replace(token.toUpperCase(), tokenMap.get(token));
if (Quests.placeholder != null) {
s = PlaceholderAPI.setPlaceholders(p, s);
}
}
return s;
}
}
}

View File

@ -1,12 +1,12 @@
name: Quests
main: me.blackvein.quests.Quests
version: ${project.version}-b${env.BUILD_NUMBER}-UNSTABLE
version: ${project.version}-b${env.BUILD_NUMBER}
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: https://github.com/Blackvein/Quests/
authors: [Blackvein, HappyPikachu]
depend: [Vault]
softdepend: [Citizens, PhatLoots]
softdepend: [Citizens, PhatLoots, PlaceholderAPI]
permissions:
quests.quest:
description: View current Quest objectives