Divert tag color to lang files, part 1. See #2202

This commit is contained in:
PikaMug 2024-05-03 10:11:48 -04:00
parent c31362baa7
commit a6635bb79c
28 changed files with 177 additions and 172 deletions

View File

@ -401,8 +401,7 @@ public class BukkitAction implements Action {
}
if (timer > 0) {
player.sendMessage(ChatColor.GREEN + BukkitLang.get(player, "timerStart")
.replace("<time>", ChatColor.RED + BukkitMiscUtil.getTime(timer * 1000L) + ChatColor.GREEN)
.replace("<quest>", ChatColor.GOLD + quest.getName() + ChatColor.GREEN));
.replace("<time>", BukkitMiscUtil.getTime(timer * 1000L)).replace("<quest>", quest.getName()));
final List<Integer> toNotify = Arrays.asList(60, 30, 10, 5, 4, 3, 2, 1);
for (final int seconds : toNotify) {
if (timer > seconds) {

View File

@ -210,13 +210,11 @@ public class BukkitQuestCommandHandler {
for (final String questId : reqs.getBlockQuestIds()) {
if (completed.containsKey(questId)) {
String msg = BukkitLang.get("haveCompleted");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ completed.get(questId) + ChatColor.RED);
msg = msg.replace("<quest>", completed.get(questId));
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.RED + msg);
} else {
String msg = BukkitLang.get("cannotComplete");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ plugin.getQuestById(questId).getName() + ChatColor.GREEN);
msg = msg.replace("<quest>", plugin.getQuestById(questId).getName());
cs.sendMessage(ChatColor.GRAY + "- " + ChatColor.GREEN + msg);
}
}

View File

@ -104,71 +104,62 @@ public class BukkitQuestadminCommandHandler {
final boolean translateSubCommands = plugin.getConfigSettings().canTranslateSubCommands();
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.stats")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_STATS_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_STATS")
: "stats") + ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_STATS") : "stats"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.give")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_GIVE_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVE")
: "give") + ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVE") : "give"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.quit")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED + BukkitLang.get("COMMAND_QUESTADMIN_QUIT_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_QUIT")
: "quit") + ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_QUIT") : "quit"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.points")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_POINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_POINTS") : "points") + ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_POINTS") : "points"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.takepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_TAKEPOINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints")
+ ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_TAKEPOINTS") : "takepoints"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.givepoints")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS_HELP")
.replace("<points>", BukkitLang.get("questPoints"))
.replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints")
+ ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_GIVEPOINTS") : "givepoints"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.finish")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_FINISH_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_FINISH") : "finish") + ChatColor.RED));
+ BukkitLang.get("COMMAND_QUESTADMIN_FINISH_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_FINISH") : "finish"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.nextstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage") + ChatColor.RED));
+ BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_NEXTSTAGE") : "nextstage"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.setstage")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage") + ChatColor.RED));
+ BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_SETSTAGE") : "setstage"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reset")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED+ BukkitLang.get("COMMAND_QUESTADMIN_RESET_HELP")
.replace("<command>", ChatColor.GOLD + (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RESET")
: "reset") + ChatColor.RED));
.replace("<command>", translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RESET") : "reset"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.remove")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_REMOVE_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_REMOVE") : "remove") + ChatColor.RED));
+ BukkitLang.get("COMMAND_QUESTADMIN_REMOVE_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_REMOVE") : "remove"));
}
if (cs.hasPermission("quests.admin.*") || cs.hasPermission("quests.admin.reload")) {
cs.sendMessage(ChatColor.YELLOW + "/questadmin " + ChatColor.RED
+ BukkitLang.get("COMMAND_QUESTADMIN_RELOAD_HELP").replace("<command>", ChatColor.GOLD
+ (translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RELOAD") : "reload") + ChatColor.RED));
+ BukkitLang.get("COMMAND_QUESTADMIN_RELOAD_HELP").replace("<command>",
translateSubCommands ? BukkitLang.get("COMMAND_QUESTADMIN_RELOAD") : "reload"));
}
}

View File

@ -77,10 +77,13 @@ public class BukkitQuestadminFinishCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
String msg = BukkitLang.get("noCurrentQuest");
@ -93,14 +96,14 @@ public class BukkitQuestadminFinishCommand extends BukkitQuestsSubCommand {
return;
}
String msg1 = BukkitLang.get("questForceFinish");
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedFinish");
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quest.completeQuest(quester);

View File

@ -76,10 +76,13 @@ public class BukkitQuestadminGiveCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quest questToGive;
StringBuilder name = new StringBuilder();
if (args.length == 3) {
@ -102,24 +105,22 @@ public class BukkitQuestadminGiveCommand extends BukkitQuestsSubCommand {
for (final Quest q : quester.getCurrentQuests().keySet()) {
if (q.getName().equalsIgnoreCase(questToGive.getName())) {
String msg = BukkitLang.get("questsPlayerHasQuestAlready");
msg = msg.replace("<player>", ChatColor.ITALIC + "" + ChatColor.GREEN + target.getName()
+ ChatColor.RESET + ChatColor.YELLOW);
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ questToGive.getName() + ChatColor.RESET + ChatColor.YELLOW);
msg = msg.replace("<player>", target.getName());
msg = msg.replace("<quest>", questToGive.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
return;
}
}
quester.hardQuit(questToGive);
String msg1 = BukkitLang.get("questForceTake");
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<quest>", ChatColor.DARK_PURPLE + questToGive.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", questToGive.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedTake");
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<quest>", ChatColor.DARK_PURPLE + questToGive.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", questToGive.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.takeQuest(questToGive, true);

View File

@ -74,10 +74,13 @@ public class BukkitQuestadminGivepointsCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final int points;
try {
points = Integer.parseInt(args[2]);
@ -88,14 +91,14 @@ public class BukkitQuestadminGivepointsCommand extends BukkitQuestsSubCommand {
final Quester quester = plugin.getQuester(target.getUniqueId());
quester.setQuestPoints(quester.getQuestPoints() + Math.abs(points));
String msg1 = BukkitLang.get("giveQuestPoints").replace("<points>", BukkitLang.get("questPoints"));
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<number>", String.valueOf(points));
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questPointsGiven").replace("<points>", BukkitLang.get("questPoints"));
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<number>", String.valueOf(points));
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.saveData();

View File

@ -77,12 +77,15 @@ public class BukkitQuestadminNextstageCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
if (quester.getCurrentQuests().isEmpty()) {
String msg = BukkitLang.get("noCurrentQuest");
msg = msg.replace("<player>", target.getName());
cs.sendMessage(ChatColor.YELLOW + msg);
@ -93,14 +96,14 @@ public class BukkitQuestadminNextstageCommand extends BukkitQuestsSubCommand {
return;
}
String msg1 = BukkitLang.get("questForceNextStage");
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questForcedNextStage");
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
p.sendMessage(ChatColor.GREEN + msg2);
}
quest.nextStage(quester, false);

View File

@ -74,10 +74,13 @@ public class BukkitQuestadminPointsCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final int points;
try {
points = Integer.parseInt(args[2]);
@ -88,14 +91,14 @@ public class BukkitQuestadminPointsCommand extends BukkitQuestsSubCommand {
final Quester quester = plugin.getQuester(target.getUniqueId());
quester.setQuestPoints(points);
String msg1 = BukkitLang.get("setQuestPoints").replace("<points>", BukkitLang.get("questPoints"));
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<number>", String.valueOf(points));
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questPointsSet").replace("<points>", BukkitLang.get("questPoints"));
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<number>", String.valueOf(points));
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.saveData();

View File

@ -77,10 +77,13 @@ public class BukkitQuestadminQuitCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
if (quester.getCurrentQuests().isEmpty() && target.getName() != null) {
String msg = BukkitLang.get("noCurrentQuest");
@ -93,12 +96,12 @@ public class BukkitQuestadminQuitCommand extends BukkitQuestsSubCommand {
return;
}
String msg1 = BukkitLang.get("questForceQuit");
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
String msg2 = BukkitLang.get((Player) target, "questForcedQuit");
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<quest>", quest.getName());
quester.quitQuest(quest, msg2);
}
} else {

View File

@ -62,8 +62,7 @@ public class BukkitQuestadminReloadCommand extends BukkitQuestsSubCommand {
if (response) {
cs.sendMessage(ChatColor.GOLD + BukkitLang.get("questsReloaded"));
String msg = BukkitLang.get("numQuestsLoaded");
msg = msg.replace("<number>", ChatColor.DARK_PURPLE + String.valueOf(plugin.getLoadedQuests().size())
+ ChatColor.GOLD);
msg = msg.replace("<number>", String.valueOf(plugin.getLoadedQuests().size()));
cs.sendMessage(ChatColor.GOLD + msg);
} else {
cs.sendMessage(ChatColor.RED + BukkitLang.get("unknownError"));

View File

@ -77,10 +77,13 @@ public class BukkitQuestadminRemoveCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quest toRemove = plugin.getQuest(concatArgArray(args, 2, args.length - 1, ' '));
if (toRemove == null) {
cs.sendMessage(ChatColor.RED + BukkitLang.get("questNotFound"));
@ -89,11 +92,11 @@ public class BukkitQuestadminRemoveCommand extends BukkitQuestsSubCommand {
final Quester quester = plugin.getQuester(target.getUniqueId());
String msg = BukkitLang.get("questRemoved");
if (target.getName() != null) {
msg = msg.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg = msg.replace("<player>", target.getName());
} else {
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
msg = msg.replace("<player>", args[1]);
}
msg = msg.replace("<quest>", ChatColor.DARK_PURPLE + toRemove.getName() + ChatColor.GOLD);
msg = msg.replace("<quest>", toRemove.getName());
cs.sendMessage(ChatColor.GOLD + msg);
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + quester.getUUID().toString());
quester.hardRemove(toRemove);

View File

@ -76,10 +76,13 @@ public class BukkitQuestadminResetCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final UUID id = target.getUniqueId();
final ConcurrentSkipListSet<Quester> temp = (ConcurrentSkipListSet<Quester>) plugin.getOfflineQuesters();
temp.removeIf(quester -> quester.getUUID().equals(id));
@ -94,9 +97,9 @@ public class BukkitQuestadminResetCommand extends BukkitQuestsSubCommand {
storage.deleteQuester(id);
String msg = BukkitLang.get("questReset");
if (target.getName() != null) {
msg = msg.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg = msg.replace("<player>", target.getName());
} else {
msg = msg.replace("<player>", ChatColor.GREEN + args[1] + ChatColor.GOLD);
msg = msg.replace("<player>", args[1]);
}
cs.sendMessage(ChatColor.GOLD + msg);
cs.sendMessage(ChatColor.DARK_PURPLE + " UUID: " + ChatColor.DARK_AQUA + id);

View File

@ -77,11 +77,14 @@ public class BukkitQuestadminSetstageCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
int stage = -1;
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
int stage;
try {
stage = Integer.parseInt(args[args.length - 1]);
} catch (final NumberFormatException e) {
@ -101,13 +104,13 @@ public class BukkitQuestadminSetstageCommand extends BukkitQuestsSubCommand {
}
if (!quester.getCurrentQuests().containsKey(quest)) {
String msg1 = BukkitLang.get("questForceTake");
msg1 = msg1.replace("<player>", ChatColor.GREEN + quester.getLastKnownName() + ChatColor.GOLD);
msg1 = msg1.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<player>", quester.getLastKnownName());
msg1 = msg1.replace("<quest>", quest.getName());
cs.sendMessage(ChatColor.GOLD + msg1);
if (quester.getPlayer() != null && quester.getPlayer().isOnline()) {
String msg2 = BukkitLang.get("questForcedTake");
msg2 = msg2.replace("<player>", ChatColor.GREEN + quester.getLastKnownName() + ChatColor.GOLD);
msg2 = msg2.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<player>", quester.getLastKnownName());
msg2 = msg2.replace("<quest>", quest.getName());
quester.sendMessage(ChatColor.GREEN + msg2);
}
quester.takeQuest(quest, true);

View File

@ -75,10 +75,13 @@ public class BukkitQuestadminStatsCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final Quester quester = plugin.getQuester(target.getUniqueId());
cs.sendMessage(ChatColor.GOLD + "- " + target.getName() + " -");
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("questPoints") + " - " + ChatColor.DARK_PURPLE

View File

@ -74,10 +74,13 @@ public class BukkitQuestadminTakepointsCommand extends BukkitQuestsSubCommand {
try {
target = Bukkit.getOfflinePlayer(UUID.fromString(args[1]));
} catch (final IllegalArgumentException e) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
// Do nothing
}
}
if (target == null || target.getName() == null) {
cs.sendMessage(ChatColor.YELLOW + BukkitLang.get("playerNotFound"));
return;
}
final int points;
try {
points = Integer.parseInt(args[2]);
@ -92,14 +95,14 @@ public class BukkitQuestadminTakepointsCommand extends BukkitQuestsSubCommand {
} else {
quester.setQuestPoints(quester.getQuestPoints() - Math.abs(points));
String msg1 = BukkitLang.get("takeQuestPoints").replace("<points>", BukkitLang.get("questPoints"));
msg1 = msg1.replace("<player>", ChatColor.GREEN + target.getName() + ChatColor.GOLD);
msg1 = msg1.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg1 = msg1.replace("<player>", target.getName());
msg1 = msg1.replace("<number>", String.valueOf(points));
cs.sendMessage(ChatColor.GOLD + msg1);
if (target.isOnline()) {
final Player p = (Player)target;
String msg2 = BukkitLang.get(p, "questPointsTaken").replace("<points>", BukkitLang.get("questPoints"));
msg2 = msg2.replace("<player>", ChatColor.GREEN + cs.getName() + ChatColor.GOLD);
msg2 = msg2.replace("<number>", ChatColor.DARK_PURPLE + "" + points + ChatColor.GOLD);
msg2 = msg2.replace("<player>", cs.getName());
msg2 = msg2.replace("<number>", String.valueOf(points));
p.sendMessage(ChatColor.GREEN + msg2);
}
quester.saveData();

View File

@ -104,9 +104,8 @@ public class BukkitQuestsCommandHandler {
if (cmd.getName().equals("choice")) {
continue;
}
cs.sendMessage(ChatColor.YELLOW + "/quests " + cmd.getDescription().replace("<command>", ChatColor.GOLD
+ (plugin.getConfigSettings().canTranslateSubCommands() ? cmd.getNameI18N() : cmd.getName())
+ ChatColor.YELLOW));
cs.sendMessage(ChatColor.YELLOW + "/quests " + cmd.getDescription().replace("<command>",
plugin.getConfigSettings().canTranslateSubCommands() ? cmd.getNameI18N() : cmd.getName()));
}
if (cs instanceof Player) {
cs.sendMessage(ChatColor.DARK_AQUA + "/quest " + ChatColor.YELLOW + BukkitLang.get(cs, "COMMAND_QUEST_HELP"));

View File

@ -79,7 +79,7 @@ public class BukkitQuestsQuitCommand extends BukkitQuestsSubCommand {
if (quest != null) {
if (quest.getOptions().canAllowQuitting()) {
final String msg = ChatColor.YELLOW + BukkitLang.get(player, "questQuit").replace("<quest>",
ChatColor.DARK_PURPLE + quest.getName() + ChatColor.YELLOW);
quest.getName());
quester.abandonQuest(quest, msg);
} else {
BukkitLang.send(player, ChatColor.YELLOW + BukkitLang.get(player, "questQuitDisabled"));

View File

@ -104,7 +104,7 @@ public class BukkitQuestsTopCommand extends BukkitQuestsSubCommand {
final LinkedHashMap<String, Integer> sortedMap = (LinkedHashMap<String, Integer>) sort(questPoints);
int numPrinted = 0;
String msg = BukkitLang.get(cs, "topQuestersTitle");
msg = msg.replace("<number>", ChatColor.DARK_PURPLE + "" + topNumber + ChatColor.GOLD);
msg = msg.replace("<number>", String.valueOf(topNumber));
cs.sendMessage(ChatColor.GOLD + msg);
for (final Map.Entry<String, Integer> entry : sortedMap.entrySet()) {
numPrinted++;

View File

@ -133,8 +133,7 @@ public class QuestMobsPrompt extends QuestsEditorNumericPrompt {
if (locations != null && radii != null && names != null) {
for (int i = 0; i < mobs.size(); i++) {
String msg = BukkitLang.get("blocksWithin");
msg = msg.replace("<amount>", ChatColor.DARK_PURPLE + "" + radii.get(i)
+ ChatColor.GRAY);
msg = msg.replace("<amount>", String.valueOf(radii.get(i)));
text.append("\n").append(ChatColor.GRAY).append(" - ").append(ChatColor.BLUE)
.append(BukkitMiscUtil.getPrettyMobName(Objects.requireNonNull(BukkitMiscUtil
.getProperMobType(mobs.get(i))))).append(ChatColor.GRAY).append(" x ")

View File

@ -461,11 +461,11 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
String text = getQueryText(context);
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replace("<money>", ChatColor.DARK_PURPLE+ ((plugin.getDependencies().getVaultEconomy()
.currencyNamePlural().isEmpty() ? BukkitLang.get("money") : plugin.getDependencies().getVaultEconomy()
.currencyNamePlural())) + ChatColor.YELLOW);
text = text.replace("<money>", ((plugin.getDependencies().getVaultEconomy()
.currencyNamePlural().isEmpty() ? BukkitLang.get("money")
: plugin.getDependencies().getVaultEconomy().currencyNamePlural())));
} else {
text = text.replace("<money>", ChatColor.DARK_PURPLE + BukkitLang.get("money") + ChatColor.YELLOW);
text = text.replace("<money>", BukkitLang.get("money"));
}
return ChatColor.YELLOW + text;
}
@ -915,7 +915,7 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
s = s.trim();
if (plugin.getQuest(s) == null) {
String text = BukkitLang.get("reqNotAQuestName");
text = text.replace("<quest>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
text = text.replace("<quest>", s);
context.getForWhom().sendRawMessage(text);
return new QuestRequirementsQuestListPrompt(context, isRequiredQuest);
}
@ -1103,7 +1103,7 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
return new QuestMcMMOSkillsPrompt(context);
} else {
String text = BukkitLang.get("reqMcMMOError");
text = text.replace("<input>", ChatColor.RED + s + ChatColor.YELLOW);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
return new QuestMcMMOSkillsPrompt(context);
}
@ -1159,7 +1159,7 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
amounts.add(i);
} catch (final NumberFormatException nfe) {
String text = BukkitLang.get("reqNotANumber");
text = text.replace("<input>", ChatColor.RED + s + ChatColor.YELLOW);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.YELLOW + text);
return new QuestMcMMOAmountsPrompt(context);
}
@ -1734,7 +1734,7 @@ public class QuestRequirementsPrompt extends QuestsEditorNumericPrompt {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
}
String lang = BukkitLang.get("stageEditorCustomDataPrompt");
lang = lang.replace("<data>", ChatColor.GOLD + temp + ChatColor.YELLOW);
lang = lang.replace("<data>", temp);
text += ChatColor.YELLOW + lang;
}
return text;

View File

@ -490,8 +490,7 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
String text = getQueryText(context);
if (plugin.getDependencies().getVaultEconomy() != null) {
text = text.replace("<money>", ChatColor.AQUA
+ plugin.getDependencies().getVaultEconomy().currencyNamePlural() + ChatColor.YELLOW);
text = text.replace("<money>", plugin.getDependencies().getVaultEconomy().currencyNamePlural());
}
return ChatColor.YELLOW + text;
}
@ -1266,7 +1265,7 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
}
} else {
String text = BukkitLang.get("reqMcMMOError");
text = text.replace("<input>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.RED + text);
return new QuestMcMMOSkillsPrompt(context);
}
@ -1315,7 +1314,7 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
amounts.add(Integer.parseInt(s));
} catch (final NumberFormatException e) {
String text = BukkitLang.get("reqNotANumber");
text = text.replace("<input>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.RED + text);
return new QuestMcMMOAmountsPrompt(context);
}
@ -1525,7 +1524,7 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
final HeroClass hc = plugin.getDependencies().getHeroes().getClassManager().getClass(s);
if (hc == null) {
String text = BukkitLang.get("rewHeroesInvalidClass");
text = text.replace("<input>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.RED + text);
return new QuestHeroesClassesPrompt(context);
} else {
@ -1579,7 +1578,7 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
amounts.add(d);
} catch (final NumberFormatException nfe) {
String text = BukkitLang.get("reqNotANumber");
text = text.replace("<input>", ChatColor.LIGHT_PURPLE + s + ChatColor.RED);
text = text.replace("<input>", s);
context.getForWhom().sendRawMessage(ChatColor.RED + text);
return new QuestHeroesExperiencePrompt(context);
}
@ -1953,10 +1952,10 @@ public class QuestRewardsPrompt extends QuestsEditorNumericPrompt {
= (Map<String, String>) context.getSessionData(Key.REW_CUSTOM_DATA_DESCRIPTIONS);
if (temp != null && descriptions != null) {
if (descriptions.get(temp) != null) {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
text += descriptions.get(temp) + "\n";
}
String lang = BukkitLang.get("stageEditorCustomDataPrompt");
lang = lang.replace("<data>", ChatColor.GOLD + temp + ChatColor.YELLOW);
lang = lang.replace("<data>", temp);
text += ChatColor.YELLOW + lang;
}
return text;

View File

@ -2751,7 +2751,7 @@ public class QuestStageMainPrompt extends QuestsEditorNumericPrompt {
text += ChatColor.GOLD + descriptions.get(temp) + "\n";
}
String msg = BukkitLang.get("stageEditorCustomDataPrompt");
msg = msg.replace("<data>", ChatColor.GOLD + temp + ChatColor.YELLOW);
msg = msg.replace("<data>", temp);
text += ChatColor.YELLOW + msg;
return text;
}

View File

@ -41,7 +41,8 @@ public class BukkitPartiesListener implements Listener {
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
BukkitLang.send(p, ChatColor.GREEN + BukkitLang.get(p, "questPartiesJoin"));
event.getParty().broadcastMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
event.getParty().broadcastMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast")
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
}
}
@ -50,7 +51,8 @@ public class BukkitPartiesListener implements Listener {
final Player p = Bukkit.getServer().getPlayer(event.getPartyPlayer().getPlayerUUID());
if (p != null && BukkitLang.get("questPartiesLeave").length() > 0) {
BukkitLang.send(p, ChatColor.RED + BukkitLang.get(p, "questPartiesLeave"));
event.getParty().broadcastMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast").replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
event.getParty().broadcastMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast")
.replace("<player>", event.getPartyPlayer().getName()), event.getPartyPlayer());
}
}
}

View File

@ -382,18 +382,15 @@ public class BukkitPlayerListener implements Listener {
if (bukkitQuest.getPlanner().getCooldown() > -1
&& (quester.getRemainingCooldown(bukkitQuest)) > 0) {
String early = BukkitLang.get(player, "questTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + bukkitQuest.getName()
+ ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.DARK_PURPLE
+ BukkitMiscUtil.getTime(quester.getRemainingCooldown(bukkitQuest))
+ ChatColor.YELLOW);
early = early.replace("<quest>", bukkitQuest.getName());
early = early.replace("<time>", BukkitMiscUtil.getTime(
quester.getRemainingCooldown(bukkitQuest)));
BukkitLang.send(player, ChatColor.YELLOW + early);
continue;
} else if (quester.getCompletedQuests().contains(bukkitQuest)
&& bukkitQuest.getPlanner().getCooldown() < 0) {
String completed = BukkitLang.get(player, "questAlreadyCompleted");
completed = completed.replace("<quest>", ChatColor.AQUA
+ bukkitQuest.getName() + ChatColor.YELLOW);
completed = completed.replace("<quest>", bukkitQuest.getName());
BukkitLang.send(player, ChatColor.YELLOW + completed);
continue;
}
@ -553,7 +550,7 @@ public class BukkitPlayerListener implements Listener {
if (!event.getMessage().startsWith("/quest")) {
final Player player = event.getPlayer();
BukkitLang.send(player, ChatColor.RED + BukkitLang.get(player, "optCommandsDenied")
.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.RED));
.replace("<quest>", quest.getName()));
event.setCancelled(true);
plugin.getLogger().info("Player " + player.getName() + " tried to use command "
+ event.getMessage() + " but was denied because they are currently on quest "

View File

@ -58,7 +58,8 @@ public class BukkitUniteListener implements Listener {
continue;
}
if (event.getPartyProvider().areInSameParty(p, online)) {
online.sendMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast").replace("<player>", p.getName()));
online.sendMessage(ChatColor.GREEN + BukkitLang.get("questPartiesJoinBroadcast")
.replace("<player>", p.getName()));
}
}
}
@ -76,7 +77,8 @@ public class BukkitUniteListener implements Listener {
continue;
}
if (event.getPartyProvider().areInSameParty(p, online)) {
online.sendMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast").replace("<player>", p.getName()));
online.sendMessage(ChatColor.RED + BukkitLang.get("questPartiesLeaveBroadcast")
.replace("<player>", p.getName()));
}
}
}

View File

@ -558,8 +558,7 @@ public class BukkitQuester implements Quester {
.equals(getPlayer().getLocation().getWorld().getName())
&& npc.getLocation().distance(getPlayer().getLocation()) > 6.0) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "mustSpeakTo")
.replace("<npc>", ChatColor.DARK_PURPLE + npc.getName() + ChatColor.YELLOW);
final String msg = BukkitLang.get(getPlayer(), "mustSpeakTo").replace("<npc>", npc.getName());
sendMessage(ChatColor.YELLOW + msg);
}
return false;
@ -571,7 +570,7 @@ public class BukkitQuester implements Quester {
znpc.getLocation().toBukkitLocation(znpc.getWorld()).distance(getPlayer().getLocation()) > 6.0) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "mustSpeakTo")
.replace("<npc>", ChatColor.DARK_PURPLE + plugin.getDependencies().getNpcName(znpc.getUuid()) + ChatColor.YELLOW);
.replace("<npc>", plugin.getDependencies().getNpcName(znpc.getUuid()));
sendMessage(ChatColor.YELLOW + msg);
}
return false;
@ -595,31 +594,31 @@ public class BukkitQuester implements Quester {
} else if (getCompletedQuests().contains(bukkitQuest) && bukkitQuest.getPlanner().getCooldown() < 0) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "questAlreadyCompleted")
.replace("<quest>", ChatColor.DARK_PURPLE + bukkitQuest.getName() + ChatColor.YELLOW);
.replace("<quest>", bukkitQuest.getName());
sendMessage(ChatColor.YELLOW + msg);
}
return false;
} else if (bukkitQuest.getBlockStart() != null) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "noCommandStart").replace("<quest>", ChatColor.DARK_PURPLE
+ bukkitQuest.getName() + ChatColor.YELLOW);
final String msg = BukkitLang.get(getPlayer(), "noCommandStart").replace("<quest>",
bukkitQuest.getName());
sendMessage(ChatColor.YELLOW + msg);
}
return false;
} else if (getCompletedQuests().contains(bukkitQuest) && getRemainingCooldown(bukkitQuest) > 0
&& !bukkitQuest.getPlanner().getOverride()) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "questTooEarly").replace("<quest>", ChatColor.AQUA
+ bukkitQuest.getName()+ ChatColor.YELLOW).replace("<time>", ChatColor.DARK_PURPLE
+ BukkitMiscUtil.getTime(getRemainingCooldown(bukkitQuest)) + ChatColor.YELLOW);
final String msg = BukkitLang.get(getPlayer(), "questTooEarly").replace("<quest>",
bukkitQuest.getName()).replace("<time>", BukkitMiscUtil
.getTime(getRemainingCooldown(bukkitQuest)));
getPlayer().sendMessage(ChatColor.YELLOW + msg);
}
return false;
} else if (bukkitQuest.getRegionStart() != null) {
if (!bukkitQuest.isInRegionStart(this)) {
if (giveReason) {
final String msg = BukkitLang.get(getPlayer(), "questInvalidLocation").replace("<quest>", ChatColor.AQUA
+ bukkitQuest.getName() + ChatColor.YELLOW);
final String msg = BukkitLang.get(getPlayer(), "questInvalidLocation").replace("<quest>",
bukkitQuest.getName());
getPlayer().sendMessage(ChatColor.YELLOW + msg);
}
return false;
@ -648,9 +647,8 @@ public class BukkitQuester implements Quester {
if (currentTime < start) {
if (giveReason) {
String early = BukkitLang.get("plnTooEarly");
early = early.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW);
early = early.replace("<time>", ChatColor.RED
+ BukkitMiscUtil.getTime(start - currentTime) + ChatColor.YELLOW);
early = early.replace("<quest>", quest.getName());
early = early.replace("<time>", BukkitMiscUtil.getTime(start - currentTime));
sendMessage(ChatColor.YELLOW + early);
}
return false;
@ -660,9 +658,8 @@ public class BukkitQuester implements Quester {
if (currentTime > end) {
if (giveReason) {
String late = BukkitLang.get("plnTooLate");
late = late.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.RED);
late = late.replace("<time>", ChatColor.DARK_PURPLE
+ BukkitMiscUtil.getTime(currentTime - end) + ChatColor.RED);
late = late.replace("<quest>", quest.getName());
late = late.replace("<time>", BukkitMiscUtil.getTime(currentTime - end));
sendMessage(ChatColor.RED + late);
}
return false;
@ -712,10 +709,8 @@ public class BukkitQuester implements Quester {
// If quest is not active, or new period of activity should override player cooldown
if (!active || (quest.getPlanner().getOverride() && completedEnd > 0L && currentTime < completedEnd)) {
if (giveReason) {
final String early = BukkitLang.get("plnTooEarly")
.replace("<quest>", ChatColor.AQUA + quest.getName() + ChatColor.YELLOW)
.replace("<time>", ChatColor.DARK_PURPLE
+ BukkitMiscUtil.getTime((completedEnd) - currentTime) + ChatColor.YELLOW);
final String early = BukkitLang.get("plnTooEarly").replace("<quest>", quest.getName())
.replace("<time>", BukkitMiscUtil.getTime((completedEnd) - currentTime));
sendMessage(ChatColor.YELLOW + early);
}
return false;
@ -1046,21 +1041,18 @@ public class BukkitQuester implements Quester {
for (final String questId : requirements.getNeededQuestIds()) {
if (completed.containsKey(questId)) {
String msg = BukkitLang.get("haveCompleted");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ completed.get(questId) + ChatColor.GREEN);
msg = msg.replace("<quest>", completed.get(questId));
finishedRequirements.add(ChatColor.GREEN + msg);
} else {
String msg = BukkitLang.get("mustComplete");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ plugin.getQuestById(questId).getName() + ChatColor.GREEN);
msg = msg.replace("<quest>", plugin.getQuestById(questId).getName());
unfinishedRequirements.add(ChatColor.GRAY + msg);
}
}
for (final String questId : requirements.getBlockQuestIds()) {
if (completed.containsKey(questId)) {
String msg = BukkitLang.get("cannotComplete");
msg = msg.replace("<quest>", ChatColor.ITALIC + "" + ChatColor.DARK_PURPLE
+ quest.getName() + ChatColor.RED);
msg = msg.replace("<quest>", quest.getName());
current.add(ChatColor.RED + msg);
}
}
@ -3561,7 +3553,7 @@ public class BukkitQuester implements Quester {
private String formatCompletedObjectiveMessage(final String langKey, final int goal) {
String message = ChatColor.GREEN + "(" + BukkitLang.get("completed") + ") " + BukkitLang.get(langKey);
if (message.contains("<count>")) {
message = message.replace("<count>", "" + ChatColor.GREEN + goal + "/" + goal);
message = message.replace("<count>", goal + "/" + goal);
}
if (plugin.getDependencies().getPlaceholderApi() != null) {
message = PlaceholderAPI.setPlaceholders(getPlayer(), message);
@ -4071,7 +4063,7 @@ public class BukkitQuester implements Quester {
/*if (q.equals(quest) == false) {
if (getPlayer() != null && getPlayer().isOnline()) {
quitQuest(quest, ChatColor.GOLD + Lang.get("questModified")
.replace("<quest>", ChatColor.DARK_PURPLE + quest.getName() + ChatColor.GOLD));
.replace("<quest>", quest.getName()));
}
}*/
}
@ -4080,8 +4072,7 @@ public class BukkitQuester implements Quester {
}
}
if (!exists) {
sendMessage(ChatColor.RED + BukkitLang.get("questNotExist").replace("<quest>", ChatColor.DARK_PURPLE
+ quest.getName() + ChatColor.RED));
sendMessage(ChatColor.RED + BukkitLang.get("questNotExist").replace("<quest>", quest.getName()));
}
}
}
@ -4301,14 +4292,14 @@ public class BukkitQuester implements Quester {
quest.updateCompass(BukkitQuester.this, stage);
if (notify) {
sendMessage(ChatColor.YELLOW + BukkitLang.get(getPlayer(), "compassSet")
.replace("<quest>", ChatColor.GOLD + quest.getName() + ChatColor.YELLOW));
.replace("<quest>", quest.getName()));
}
} else {
resetCompass();
setCompassTarget(quest);
if (notify) {
sendMessage(ChatColor.RED + BukkitLang.get(getPlayer(), "compassNone")
.replace("<quest>", ChatColor.GRAY + quest.getName() + ChatColor.RED));
.replace("<quest>", quest.getName()));
}
}
}

View File

@ -894,8 +894,7 @@ public class BukkitQuest implements Quest {
// Inform player
if (player.isOnline()) {
final Player p = (Player)player;
BukkitLang.send(p, ChatColor.GOLD + BukkitLang.get(p, "questCompleteTitle").replace("<quest>",
ChatColor.YELLOW + name + ChatColor.GOLD));
BukkitLang.send(p, ChatColor.GOLD + BukkitLang.get(p, "questCompleteTitle").replace("<quest>", name));
if (plugin.getConfigSettings().canShowQuestTitles()) {
final String title = ChatColor.GOLD + BukkitLang.get(p, "quest") + " " + BukkitLang.get(p, "complete");
final String subtitle = ChatColor.YELLOW + name;

View File

@ -37,8 +37,7 @@ public class BukkitActionTimer extends BukkitRunnable {
quester.updateJournal();
} else if (quester.getOfflinePlayer().isOnline()){
quester.getPlayer().sendMessage(ChatColor.GREEN + BukkitLang.get(quester.getPlayer(), "timerMessage")
.replace("<time>", ChatColor.RED + BukkitMiscUtil.getTime(time * 1000L) + ChatColor.GREEN)
.replace("<quest>", ChatColor.GOLD + quest.getName() + ChatColor.GREEN));
.replace("<time>", BukkitMiscUtil.getTime(time * 1000L)).replace("<quest>", quest.getName()));
}
}
}