Finished version 1.9.0

Completed language file
Added legacy support
This commit is contained in:
Blackvein 2014-07-08 17:30:33 -07:00
parent 8a574bc9f3
commit 79ddad8b9e
28 changed files with 2669 additions and 1961 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

25
pom.xml
View File

@ -3,7 +3,7 @@
<groupId>me.blackvein.quests</groupId>
<artifactId>quests</artifactId>
<version>1.8.2</version>
<version>1.9.0</version>
<name>quests</name>
<url>http://dev.bukkit.org/server-mods/quests/</url>
<packaging>jar</packaging>
@ -24,10 +24,17 @@
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.7.9-R0.2</version>
<artifactId>craftbukkit1</artifactId>
<version>1.7.9-R0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftbukkit-1.7.9-R0.2.jar</systemPath>
<systemPath>${project.basedir}/lib/craftbukkit-1.7.2-R0.4.jar</systemPath>
</dependency>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit2</artifactId>
<version>1.7.9-R0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/craftbukkit-1.7.9-R0.3.jar</systemPath>
</dependency>
<dependency>
<groupId>com.citizensnpcs</groupId>
@ -46,21 +53,21 @@
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>Vault</artifactId>
<version>1.2.27</version>
<version>1.4.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Vault.jar</systemPath>
</dependency>
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>1.4.07-beta1-b2226</version>
<version>1.5.00</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/mcMMO.jar</systemPath>
</dependency>
<dependency>
<groupId>com.herocraftonline</groupId>
<artifactId>Heroes</artifactId>
<version>1.5.5</version>
<version>1.5.5.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/Heroes.jar</systemPath>
</dependency>
@ -74,14 +81,14 @@
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>WorldEdit</artifactId>
<version>5.5.8</version>
<version>5.6.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/WorldEdit.jar</systemPath>
</dependency>
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>WorldGuard</artifactId>
<version>5.8</version>
<version>5.9</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/WorldGuard.jar</systemPath>
</dependency>

View File

@ -0,0 +1,68 @@
package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
public enum Eff_1_7_R1 {
HUGE_EXPLOSION("hugeexplosion"),
LARGE_EXPLODE("largeexplode"),
FIREWORKS_SPARK("fireworksSpark"),
BUBBLE("bubble"),
SUSPEND("susgpend"),
DEPTH_SUSPEND("depthSuspend"),
TOWN_AURA("townaura"),
CRIT("crit"),
MAGIC_CRIT("magicCrit"),
MOB_SPELL("mobSpell"),
MOB_SPELL_AMBIENT("mobSpellAmbient"),
SPELL("spell"),
INSTANT_SPELL("instantSpell"),
WITCH_MAGIC("witchMagic"),
NOTE("note"),
PORTAL("portal"),
ENCHANTMENT_TABLE("enchantmenttable"),
EXPLODE("explode"),
FLAME("flame"),
LAVA("lava"),
FOOTSTEP("footstep"),
SPLASH("splash"),
LARGE_SMOKE("largesmoke"),
CLOUD("cloud"),
RED_DUST("reddust"),
SNOWBALL_POOF("snowballpoof"),
DRIP_WATER("dripWater"),
DRIP_LAVA("dripLava"),
SNOW_SHOVEL("snowshovel"),
SLIME("slime"),
HEART("heart"),
ANGRY_VILLAGER("angryVillager"),
HAPPY_VILLAGER("happyVillager"),
ICONCRACK("iconcrack_"),
TILECRACK("tilecrack_");
private final String particleName;
Eff_1_7_R1(String particleName) {
this.particleName = particleName;
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
ReflectionUtil.setValue(packet, "a", particleName);
ReflectionUtil.setValue(packet, "b", (float) location.getX());
ReflectionUtil.setValue(packet, "c", (float) location.getY());
ReflectionUtil.setValue(packet, "d", (float) location.getZ());
ReflectionUtil.setValue(packet, "e", offsetX);
ReflectionUtil.setValue(packet, "f", offsetY);
ReflectionUtil.setValue(packet, "g", offsetZ);
ReflectionUtil.setValue(packet, "h", speed);
ReflectionUtil.setValue(packet, "i", count);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}

View File

@ -0,0 +1,68 @@
package me.blackvein.particles;
import me.blackvein.quests.util.ReflectionUtil;
import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
public enum Eff_1_7_R3 {
HUGE_EXPLOSION("hugeexplosion"),
LARGE_EXPLODE("largeexplode"),
FIREWORKS_SPARK("fireworksSpark"),
BUBBLE("bubble"),
SUSPEND("susgpend"),
DEPTH_SUSPEND("depthSuspend"),
TOWN_AURA("townaura"),
CRIT("crit"),
MAGIC_CRIT("magicCrit"),
MOB_SPELL("mobSpell"),
MOB_SPELL_AMBIENT("mobSpellAmbient"),
SPELL("spell"),
INSTANT_SPELL("instantSpell"),
WITCH_MAGIC("witchMagic"),
NOTE("note"),
PORTAL("portal"),
ENCHANTMENT_TABLE("enchantmenttable"),
EXPLODE("explode"),
FLAME("flame"),
LAVA("lava"),
FOOTSTEP("footstep"),
SPLASH("splash"),
LARGE_SMOKE("largesmoke"),
CLOUD("cloud"),
RED_DUST("reddust"),
SNOWBALL_POOF("snowballpoof"),
DRIP_WATER("dripWater"),
DRIP_LAVA("dripLava"),
SNOW_SHOVEL("snowshovel"),
SLIME("slime"),
HEART("heart"),
ANGRY_VILLAGER("angryVillager"),
HAPPY_VILLAGER("happyVillager"),
ICONCRACK("iconcrack_"),
TILECRACK("tilecrack_");
private final String particleName;
Eff_1_7_R3(String particleName) {
this.particleName = particleName;
}
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
ReflectionUtil.setValue(packet, "a", particleName);
ReflectionUtil.setValue(packet, "b", (float) location.getX());
ReflectionUtil.setValue(packet, "c", (float) location.getY());
ReflectionUtil.setValue(packet, "d", (float) location.getZ());
ReflectionUtil.setValue(packet, "e", offsetX);
ReflectionUtil.setValue(packet, "f", offsetY);
ReflectionUtil.setValue(packet, "g", offsetZ);
ReflectionUtil.setValue(packet, "h", speed);
ReflectionUtil.setValue(packet, "i", count);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
}

View File

@ -15,6 +15,7 @@ import me.blackvein.quests.util.CK;
import static me.blackvein.quests.util.ColorUtil.PURPLE;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.MiscUtil;
import me.blackvein.quests.util.QuestMob;
import net.citizensnpcs.api.CitizensAPI;
@ -36,6 +37,7 @@ import org.bukkit.conversations.FixedSetPrompt;
import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
@ -104,7 +106,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
public String getPromptText(ConversationContext context) {
String text =
GOLD + "- " + Lang.get("eventEditorTitle") + " -\n"
GOLD + Lang.get("eventEditorTitle") + "\n"
+ BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorCreate") + "\n"
+ BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("eventEditorEdit") + "\n"
+ BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorDelete") + "\n"
@ -126,7 +128,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
context.setSessionData(CK.E_OLD_EVENT, "");
return new EventNamePrompt();
}else{
player.sendMessage(RED + "You do not have permission to create new Events.");
player.sendMessage(RED + Lang.get("eventEditorCreatePermisssions"));
return new MenuPrompt();
}
@ -143,7 +145,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}else{
player.sendMessage(RED + "You do not have permission to edit Events.");
player.sendMessage(RED + Lang.get("eventEditorEditPermisssions"));
return new MenuPrompt();
}
@ -160,7 +162,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}else{
player.sendMessage(RED + "You do not have permission to delete Events.");
player.sendMessage(RED + Lang.get("eventEditorDeletePermisssions"));
return new MenuPrompt();
}
@ -216,14 +218,14 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
context.setSessionData(CK.E_MESSAGE, event.message);
if(event.clearInv == true)
context.setSessionData(CK.E_CLEAR_INVENTORY, "Yes");
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord"));
else
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
if (event.failQuest == true)
context.setSessionData(CK.E_FAIL_QUEST, "Yes");
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
else
context.setSessionData(CK.E_FAIL_QUEST, "No");
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
if(event.items != null && event.items.isEmpty() == false){
@ -466,7 +468,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
String text =
RED + Lang.get("eventEditorDeletePrompt") + " \"" + GOLD + (String)context.getSessionData(CK.ED_EVENT_DELETE) + RED + "\"?\n";
text += YELLOW + Lang.get("yes") + "/" + Lang.get("no");
text += YELLOW + Lang.get("yesWord") + "/" + Lang.get("noWord");
return text;
@ -475,10 +477,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if(input.equalsIgnoreCase(Lang.get("yes"))){
if(input.equalsIgnoreCase(Lang.get("yesWord"))){
deleteEvent(context);
return new MenuPrompt();
}else if(input.equalsIgnoreCase(Lang.get("no"))){
}else if(input.equalsIgnoreCase(Lang.get("noWord"))){
return new MenuPrompt();
}else {
return new DeletePrompt();
@ -690,10 +692,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
} else if (input.equalsIgnoreCase("3")) {
String s = (String) context.getSessionData(CK.E_CLEAR_INVENTORY);
if (s.equalsIgnoreCase("Yes")) {
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("noWord"));
} else {
context.setSessionData(CK.E_CLEAR_INVENTORY, "Yes");
context.setSessionData(CK.E_CLEAR_INVENTORY, Lang.get("yesWord"));
}
return new CreateMenuPrompt();
@ -701,10 +703,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
} else if (input.equalsIgnoreCase("4")) {
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
if (s.equalsIgnoreCase("Yes")) {
context.setSessionData(CK.E_FAIL_QUEST, "No");
if (s.equalsIgnoreCase(Lang.get("yesWord"))) {
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("noWord"));
} else {
context.setSessionData(CK.E_FAIL_QUEST, "Yes");
context.setSessionData(CK.E_FAIL_QUEST, Lang.get("yesWord"));
}
return new CreateMenuPrompt();
@ -790,7 +792,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
String text =
GREEN + Lang.get("eventEditorQuitWithoutSaving") + "\n";
text += YELLOW + Lang.get("yes") + "/" + Lang.get("no");
text += YELLOW + Lang.get("yesWord") + "/" + Lang.get("noWord");
return text;
@ -799,10 +801,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if(input.equalsIgnoreCase(Lang.get("yes"))){
if(input.equalsIgnoreCase(Lang.get("yesWord"))){
clearData(context);
return new MenuPrompt();
}else if(input.equalsIgnoreCase(Lang.get("no"))){
}else if(input.equalsIgnoreCase(Lang.get("noWord"))){
return new CreateMenuPrompt();
}else{
((Player) context.getForWhom()).sendMessage(RED + Lang.get("invalidOption"));
@ -855,7 +857,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
text += GRAY + " - " + DARKRED + s + "\n";
text += RED + Lang.get("eventEditorForcedToQuit") + "\n";
}
text += YELLOW + Lang.get("yes") + "/" + Lang.get("no");
text += YELLOW + Lang.get("yesWord") + "/" + Lang.get("noWord");
return text;
@ -864,10 +866,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if(input.equalsIgnoreCase(Lang.get("yes"))){
if(input.equalsIgnoreCase(Lang.get("yesWord"))){
saveEvent(context);
return new MenuPrompt();
}else if(input.equalsIgnoreCase(Lang.get("no"))){
}else if(input.equalsIgnoreCase(Lang.get("noWord"))){
return new CreateMenuPrompt();
}else{
((Player) context.getForWhom()).sendMessage(RED + Lang.get("invalidOption"));
@ -987,13 +989,13 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
if (context.getSessionData(CK.E_CLEAR_INVENTORY) != null) {
String s = getCString(context, CK.E_CLEAR_INVENTORY);
if(s.equalsIgnoreCase("Yes"))
if(s.equalsIgnoreCase(Lang.get("yesWord")))
section.set("clear-inventory", true);
}
if (context.getSessionData(CK.E_FAIL_QUEST) != null) {
String s = getCString(context, CK.E_FAIL_QUEST);
if (s.equalsIgnoreCase("Yes"))
if (s.equalsIgnoreCase(Lang.get("yesWord")))
section.set("fail-quest", true);
}
@ -1352,7 +1354,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase("cmdNone") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdNone")) == false) {
context.setSessionData(CK.E_MESSAGE, input);
} else if (input.equalsIgnoreCase(Lang.get("cmdNone"))) {
context.setSessionData(CK.E_MESSAGE, null);
@ -1391,11 +1393,11 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}
String text = GOLD + "- Give Items -\n";
String text = GOLD + Lang.get("eventEditorGiveItemsTitle") + "\n";
if(context.getSessionData(CK.E_ITEMS) == null){
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorAddItem") + "\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done");
}else{
for(ItemStack is : getItems(context)){
@ -1404,10 +1406,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorAddItem") + "\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done");
}
@ -1421,7 +1423,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
if(input.equalsIgnoreCase("1")){
return new ItemStackPrompt(ItemListPrompt.this);
}else if(input.equalsIgnoreCase("2")){
context.getForWhom().sendRawMessage(YELLOW + "Event Items cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("eventEditorItemsCleared"));
context.setSessionData(CK.E_ITEMS, null);
return new ItemListPrompt();
}else if(input.equalsIgnoreCase("3")){
@ -1451,7 +1453,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
String text = GOLD + "- " + Lang.get("eventEditorEffects") + " -\n";
if (context.getSessionData(CK.E_EFFECTS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorAddEffect") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - Add effect location (" + Lang.get("eventEditorNoEffects") + ")\n";
text += GRAY + "2 - " + Lang.get("eventEditorAddEffectLocation") + " (" + Lang.get("eventEditorNoEffects") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
} else {
@ -1596,7 +1598,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String effects = PINK + "- Effects - \n";
String effects = PINK + Lang.get("eventEditorEffectsTitle") + "\n";
effects += PURPLE + "BLAZE_SHOOT " + GRAY + "- " + Lang.get("effBlazeShoot") + "\n";
effects += PURPLE + "BOW_FIRE " + GRAY + "- " + Lang.get("effBowFire") + "\n";
effects += PURPLE + "CLICK1 " + GRAY + "- " + Lang.get("effClick1") + "\n";
@ -1659,7 +1661,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("eventEditorStorm") + " -\n";
String text = GOLD + Lang.get("eventEditorStormTitle") + "\n";
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetWorld") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("eventEditorSetDuration") + " " + Lang.get("eventEditorNoWorld") + "\n";
@ -1725,7 +1727,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String effects = PINK + "- " + Lang.get("worlds") + " - \n" + PURPLE;
String effects = PINK + Lang.get("eventEditorWorldsTitle") + "\n" + PURPLE;
for (World w : quests.getServer().getWorlds()) {
effects += w.getName() + ", ";
}
@ -1792,7 +1794,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("eventEditorThunder") + " -\n";
String text = GOLD + Lang.get("eventEditorThunderTitle") + "\n";
if (context.getSessionData(CK.E_WORLD_THUNDER) == null) {
@ -1861,7 +1863,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String effects = PINK + "- Worlds - \n" + PURPLE;
String effects = PINK + Lang.get("eventEditorWorldsTitle") + "\n" + PURPLE;
for (World w : quests.getServer().getWorlds()) {
effects += w.getName() + ", ";
}
@ -1923,7 +1925,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("eventEditorMobSpawns") + " -\n";
String text = GOLD + Lang.get("eventEditorMobSpawnsTitle") + "\n";
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
@ -1933,7 +1935,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
for (int i = 0; i < types.size(); i++) {
QuestMob qm = QuestMob.fromString(types.get(i));
text += GOLD + " " + (i + 1) + " - Edit: " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
text += GOLD + " " + (i + 1) + " - " + Lang.get("edit") + ": " + AQUA + qm.getType().getName() + ((qm.getName() != null) ? ": " + qm.getName() : "") + GRAY + " x " + DARKAQUA + qm.getSpawnAmounts() + GRAY + " -> " + GREEN + Quests.getLocationInfo(qm.getSpawnLocation()) + "\n";
}
text += BLUE + "" + BOLD + (types.size() + 1) + RESET + YELLOW + " - " + Lang.get("eventEditorAddMobTypes") + "\n";
@ -1995,20 +1997,20 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
private final Integer mobIndex;
public QuestMobPrompt(int mobIndex, QuestMob questMob) {
this.questMob = questMob;
this.mobIndex = mobIndex;
}
this.questMob = questMob;
this.mobIndex = mobIndex;
}
@Override
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("eventEditorAddMobTypes") + " - \n";
String text = GOLD + Lang.get("eventEditorAddMobTypesTitle") + "\n";
if (questMob == null) {
questMob = new QuestMob();
}
if (questMob == null) {
questMob = new QuestMob();
}
// Check/add newly made item
// Check/add newly made item
if(context.getSessionData("newItem") != null){
if(itemIndex >= 0){
@ -2129,25 +2131,25 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}
@Override
public String getPromptText(ConversationContext context) {
String text = YELLOW + Lang.get("eventEditorSetMobNamePrompt");
return text;
}
public String getPromptText(ConversationContext context) {
String text = YELLOW + Lang.get("eventEditorSetMobNamePrompt");
return text;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new QuestMobPrompt(mobIndex, questMob);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
questMob.setName(null);
return new QuestMobPrompt(mobIndex, questMob);
} else {
input = ChatColor.translateAlternateColorCodes('&', input);
questMob.setName(input);
return new QuestMobPrompt(mobIndex, questMob);
}
}
if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new QuestMobPrompt(mobIndex, questMob);
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
questMob.setName(null);
return new QuestMobPrompt(mobIndex, questMob);
} else {
input = ChatColor.translateAlternateColorCodes('&', input);
questMob.setName(input);
return new QuestMobPrompt(mobIndex, questMob);
}
}
}
private class MobTypePrompt extends StringPrompt {
@ -2161,59 +2163,45 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
}
@Override
public String getPromptText(ConversationContext arg0) {
String mobs = PINK + "- " + Lang.get("mobs") + " - \n";
mobs += PURPLE + "Bat, ";
mobs += PURPLE + "Blaze, ";
mobs += PURPLE + "CaveSpider, ";
mobs += PURPLE + "Chicken, ";
mobs += PURPLE + "Cow, ";
mobs += PURPLE + "Creeper, ";
mobs += PURPLE + "Enderman, ";
mobs += PURPLE + "EnderDragon, ";
mobs += PURPLE + "Ghast, ";
mobs += PURPLE + "Giant, ";
mobs += PURPLE + "Horse, ";
mobs += PURPLE + "IronGolem, ";
mobs += PURPLE + "MagmaCube, ";
mobs += PURPLE + "MushroomCow, ";
mobs += PURPLE + "Ocelot, ";
mobs += PURPLE + "Pig, ";
mobs += PURPLE + "PigZombie, ";
mobs += PURPLE + "Sheep, ";
mobs += PURPLE + "Silverfish, ";
mobs += PURPLE + "Skeleton, ";
mobs += PURPLE + "Slime, ";
mobs += PURPLE + "Snowman, ";
mobs += PURPLE + "Spider, ";
mobs += PURPLE + "Squid, ";
mobs += PURPLE + "Villager, ";
mobs += PURPLE + "Witch, ";
mobs += PURPLE + "Wither, ";
mobs += PURPLE + "Wolf, ";
mobs += PURPLE + "Zombie\n";
public String getPromptText(ConversationContext arg0) {
String mobs = PINK + Lang.get("eventEditorMobsTitle") + "\n";
final EntityType[] mobArr = EntityType.values();
for(int i = 0; i < mobArr.length; i++) {
final EntityType type = mobArr[i];
if(type.isAlive() == false)
continue;
if(i < (mobArr.length - 1)) {
mobs += MiscUtil.getProperMobName(mobArr[i]) + ", ";
} else {
mobs += MiscUtil.getProperMobName(mobArr[i]) + "\n";
}
}
return mobs + YELLOW + Lang.get("eventEditorSetMobTypesPrompt");
}
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
public Prompt acceptInput(ConversationContext context, String input) {
Player player = (Player) context.getForWhom();
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if (Quests.getMobType(input) != null) {
if (MiscUtil.getProperMobType(input) != null) {
questMob.setType(Quests.getMobType(input));
questMob.setType(MiscUtil.getProperMobType(input));
} else {
player.sendMessage(PINK + input + " " + RED + Lang.get("eventEditorInvalidMob"));
return new MobTypePrompt(mobIndex, questMob);
}
}
} else {
player.sendMessage(PINK + input + " " + RED + Lang.get("eventEditorInvalidMob"));
return new MobTypePrompt(mobIndex, questMob);
}
}
return new QuestMobPrompt(mobIndex, questMob);
}
return new QuestMobPrompt(mobIndex, questMob);
}
}
private class MobAmountPrompt extends StringPrompt {
@ -2426,16 +2414,16 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("eventEditorPotionEffects") + " -\n";
String text = GOLD + Lang.get("eventEditorPotionEffectsTitle") + "\n";
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffectTypes") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("eventEditorSetPotionDurations") + " " + Lang.get("eventEditorNoTypesSet") + "\n";
text += GRAY + "3 - " + Lang.get("eventEditorSetPotionMagnitudes") + " " + Lang.get("eventEditorNoTypesSet") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += GREEN + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("done");
} else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + "\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffectTypes") + "\n";
for (String s : (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES)) {
text += GRAY + " - " + AQUA + s + "\n";
}
@ -2543,7 +2531,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
@Override
public String getPromptText(ConversationContext context) {
String effs = PINK + "- " + Lang.get("eventEditorPotionEffects") + " - \n";
String effs = PINK + Lang.get("eventEditorPotionTypesTitle") + "\n";
for (PotionEffectType pet : PotionEffectType.values()) {
effs += (pet != null && pet.getName() != null) ? (PURPLE + pet.getName() + "\n") : "";
}

View File

@ -1,7 +1,10 @@
package me.blackvein.quests;
import me.blackvein.particles.Eff_1_7_R3;
import java.util.List;
import me.blackvein.particles.Eff_1_7_R1;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
@ -30,8 +33,10 @@ public class NpcEffectThread implements Runnable{
if(plugin.citizens.getNPCRegistry().isNPC(e)){
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
if(plugin.hasQuest(npc, quester))
if(plugin.hasQuest(npc, quester)) {
showEffect(player, npc);
}
}
@ -43,12 +48,21 @@ public class NpcEffectThread implements Runnable{
}
private static void showEffect(Player player, NPC npc){
private static void showEffect(Player player, NPC npc) {
if(Bukkit.getVersion().contains("1.7.2"))
showEffect_R1(player, npc);
else if(Bukkit.getVersion().contains("1.7.9"))
showEffect_R3(player, npc);
}
private static void showEffect_R3(Player player, NPC npc){
if(Quests.effect.equalsIgnoreCase("enchant")){
try{
ParticleEffect.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
Eff_1_7_R3.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
}catch(Exception e){
e.printStackTrace();
}
@ -56,7 +70,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("crit")){
try{
ParticleEffect.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
Eff_1_7_R3.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -64,7 +78,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("spell")){
try{
ParticleEffect.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
Eff_1_7_R3.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -72,7 +86,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
try{
ParticleEffect.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
Eff_1_7_R3.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -80,7 +94,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
try{
ParticleEffect.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
Eff_1_7_R3.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -90,7 +104,7 @@ public class NpcEffectThread implements Runnable{
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
ParticleEffect.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
Eff_1_7_R3.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
}catch(Exception e){
e.printStackTrace();
}
@ -98,7 +112,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("portal")){
try{
ParticleEffect.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
Eff_1_7_R3.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
}catch(Exception e){
e.printStackTrace();
}
@ -108,7 +122,7 @@ public class NpcEffectThread implements Runnable{
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
ParticleEffect.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
Eff_1_7_R3.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
}catch(Exception e){
e.printStackTrace();
}
@ -116,7 +130,7 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("witch")){
try{
ParticleEffect.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
Eff_1_7_R3.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -126,7 +140,7 @@ public class NpcEffectThread implements Runnable{
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
ParticleEffect.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
Eff_1_7_R3.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
@ -136,7 +150,7 @@ public class NpcEffectThread implements Runnable{
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
ParticleEffect.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
Eff_1_7_R3.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
}catch(Exception e){
e.printStackTrace();
}
@ -144,7 +158,117 @@ public class NpcEffectThread implements Runnable{
} else if(Quests.effect.equalsIgnoreCase("smoke")){
try{
ParticleEffect.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
Eff_1_7_R3.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
}catch(Exception e){
e.printStackTrace();
}
}
}
private static void showEffect_R1(Player player, NPC npc){
if(Quests.effect.equalsIgnoreCase("enchant")){
try{
Eff_1_7_R1.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("crit")){
try{
Eff_1_7_R1.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("spell")){
try{
Eff_1_7_R1.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
try{
Eff_1_7_R1.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
try{
Eff_1_7_R1.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("note")){
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
Eff_1_7_R1.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("portal")){
try{
Eff_1_7_R1.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("dust")){
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
Eff_1_7_R1.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("witch")){
try{
Eff_1_7_R1.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("snowball")){
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
Eff_1_7_R1.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("splash")){
try{
Location old = npc.getBukkitEntity().getEyeLocation();
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
Eff_1_7_R1.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
}catch(Exception e){
e.printStackTrace();
}
} else if(Quests.effect.equalsIgnoreCase("smoke")){
try{
Eff_1_7_R1.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
}catch(Exception e){
e.printStackTrace();
}

View File

@ -3,6 +3,7 @@ package me.blackvein.quests;
import java.text.MessageFormat;
import java.util.LinkedList;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.event.NPCDeathEvent;
import net.citizensnpcs.api.event.NPCLeftClickEvent;
@ -133,7 +134,7 @@ public class NpcListener implements Listener {
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
player.sendMessage(ChatColor.YELLOW + Lang.get("questOneActive"));
}
@ -142,9 +143,14 @@ public class NpcListener implements Listener {
if (quester.currentQuest == null) {
if (quester.getDifference(q) > 0) {
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
String early = Lang.get("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) {
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
String completed = Lang.get("questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
quester.questToTake = q.name;
String s = extracted(quester);
@ -158,7 +164,7 @@ public class NpcListener implements Listener {
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
player.sendMessage(ChatColor.YELLOW + Lang.get("questOneActive"));
}
@ -180,7 +186,7 @@ public class NpcListener implements Listener {
public void onNPCLeftClick(NPCLeftClickEvent evt){
if(plugin.questFactory.selectingNPCs.contains(evt.getClicker())){
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + "ID " + evt.getNPC().getId());
evt.getClicker().sendMessage(ChatColor.GREEN + evt.getNPC().getName() + ": " + ChatColor.DARK_GREEN + Lang.get("id") + " " + evt.getNPC().getId());
}
}

View File

@ -5,6 +5,7 @@ import com.sk89q.worldguard.protection.regions.ProtectedRegion;
import java.io.File;
import java.util.Iterator;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.CitizensAPI;
import org.bukkit.ChatColor;
import org.bukkit.Location;
@ -59,56 +60,56 @@ public class PlayerListener implements Listener, ColorUtil {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedBlockStarts.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedExplosionLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedExplosionLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedEffectLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedEffectLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedMobLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedMobLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedLightningLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedLightningLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.eventFactory.selectedTeleportLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.eventFactory.selectedTeleportLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedKillLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedKillLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (plugin.questFactory.selectedReachLocations.containsKey(evt.getPlayer())) {
Block block = evt.getClickedBlock();
Location loc = block.getLocation();
plugin.questFactory.selectedReachLocations.put(evt.getPlayer(), block);
evt.getPlayer().sendMessage(ChatColor.GOLD + "Selected location " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
evt.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questSelectedLocation") + " " + ChatColor.AQUA + loc.getWorld().getName() + ": " + loc.getX() + ", " + loc.getY() + ", " + loc.getZ() + ChatColor.GOLD + " (" + ChatColor.GREEN + Quester.prettyItemString(block.getType().getId()) + ChatColor.GOLD + ")");
} else if (player.isConversing() == false) {
@ -120,7 +121,7 @@ public class PlayerListener implements Listener, ColorUtil {
if (quester.currentQuest != null) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
player.sendMessage(ChatColor.YELLOW + Lang.get("questOneActive"));
} else {
@ -128,12 +129,17 @@ public class PlayerListener implements Listener, ColorUtil {
if (q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
String early = Lang.get("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) {
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
String completed = Lang.get("questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
return;
}
@ -188,9 +194,11 @@ public class PlayerListener implements Listener, ColorUtil {
if(ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
if (quester.currentQuest != null) {
player.sendMessage(YELLOW + "You may only have one active Quest.");
player.sendMessage(YELLOW + Lang.get("questOneActive"));
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
player.sendMessage(YELLOW + "You have already completed " + PURPLE + quest.name + YELLOW + ".");
String completed = Lang.get("questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
boolean takeable = true;
@ -198,7 +206,10 @@ public class PlayerListener implements Listener, ColorUtil {
if (quester.completedQuests.contains(quest.name)) {
if (quester.getDifference(quest) > 0) {
player.sendMessage(YELLOW + "You may not take " + AQUA + quest.name + YELLOW + " again for another " + PURPLE + Quests.getTime(quester.getDifference(quest)) + YELLOW + ".");
String early = Lang.get("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);
takeable = false;
}
@ -219,7 +230,9 @@ public class PlayerListener implements Listener, ColorUtil {
}
if (inRegion == false) {
player.sendMessage(YELLOW + "You may not take " + AQUA + quest.name + YELLOW + " at this location.");
String invalidLoc = Lang.get("questInvalidLocation");
invalidLoc = invalidLoc.replaceAll("<quest>", ChatColor.AQUA + quest.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + invalidLoc);
takeable = false;
}

View File

@ -143,7 +143,7 @@ public class Quest {
quester.addEmpties();
quester.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---");
quester.getPlayer().sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
for (String s : quester.getObjectivesReal()) {
quester.getPlayer().sendMessage(s);
@ -272,7 +272,7 @@ public class Quest {
Player player = plugin.getServer().getPlayerExact(q.name);
q.resetObjectives();
q.completedQuests.add(name);
String none = ChatColor.GRAY + "- (None)";
String none = ChatColor.GRAY + "- (" + Lang.get("none") + ")";
String ps = Quests.parseString(finished, q.currentQuest);
@ -365,11 +365,13 @@ public class Quest {
none = null;
}
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
player.sendMessage(ChatColor.GREEN + "Rewards:");
String complete = Lang.get("questCompleteTitle");
complete = complete.replaceAll("<quest>", ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD);
player.sendMessage(ChatColor.GOLD + complete);
player.sendMessage(ChatColor.GREEN + Lang.get("questRewardsTitle"));
if (questPoints > 0) {
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " " + Lang.get("questPoints"));
q.questPoints += questPoints;
none = null;
}
@ -381,21 +383,21 @@ 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 + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
} else if (i.getDurability() != 0) {
if(i.getEnchantments().isEmpty())
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
else
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
} else {
if(i.getEnchantments().isEmpty())
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
else
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
@ -409,21 +411,21 @@ 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 + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
} else if (i.getDurability() != 0) {
if(i.getEnchantments().isEmpty())
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
else
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
} else {
if(i.getEnchantments().isEmpty())
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
else
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " *Enchanted*");
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount() + ChatColor.DARK_PURPLE + " " + Lang.get("enchantedItem"));
}
@ -441,20 +443,20 @@ public class Quest {
if (exp > 0 || phatLootExp > 0) {
int tot = exp + phatLootExp;
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " Experience");
player.sendMessage("- " + ChatColor.DARK_GREEN + tot + ChatColor.DARK_PURPLE + " " + Lang.get("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 + " Experience");
player.sendMessage("- " + ChatColor.DARK_GREEN + mcmmoAmounts.get(mcmmoSkills.indexOf(s)) + " " + ChatColor.DARK_PURPLE + s + " " + Lang.get("experience"));
}
none = null;
}
if (heroesClasses.isEmpty() == false) {
for (String s : heroesClasses) {
player.sendMessage("- " + ChatColor.AQUA + heroesAmounts.get(heroesClasses.indexOf(s)) + " " + ChatColor.BLUE + s + " Experience");
player.sendMessage("- " + ChatColor.AQUA + heroesAmounts.get(heroesClasses.indexOf(s)) + " " + ChatColor.BLUE + s + " " + Lang.get("experience"));
}
none = null;
}
@ -512,7 +514,9 @@ public class Quest {
Player player = plugin.getServer().getPlayerExact(q.name);
q.resetObjectives();
player.sendMessage(ChatColor.AQUA + "-- " + ChatColor.DARK_PURPLE + q.currentQuest.name + ChatColor.AQUA + " -- ");
String title = Lang.get("questTitle");
title = title.replaceAll("<quest>", ChatColor.DARK_PURPLE + q.currentQuest.name + ChatColor.AQUA);
player.sendMessage(ChatColor.AQUA + title);
player.sendMessage(ChatColor.RED + Lang.get("questFailed"));
q.currentQuest = null;

View File

@ -18,6 +18,7 @@ import me.blackvein.quests.prompts.RequirementsPrompt;
import me.blackvein.quests.prompts.RewardsPrompt;
import me.blackvein.quests.prompts.StagesPrompt;
import me.blackvein.quests.util.CK;
import static me.blackvein.quests.util.ColorUtil.PURPLE;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.CitizensAPI;
@ -93,7 +94,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public String getPromptText(ConversationContext context) {
String text
= GOLD + "- Quest Editor -\n"
= GOLD + Lang.get("questEditorTitle") + "\n"
+ BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("questEditorCreate") + "\n"
+ BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("questEditorEdit") + "\n"
+ BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("questEditorDelete") + "\n"
@ -163,24 +164,24 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public String getPromptText(ConversationContext context) {
String text
= GOLD + "- Quest: " + AQUA + context.getSessionData(CK.Q_NAME) + GOLD + " -\n";
= GOLD + "- " + Lang.get("quest") + ": " + AQUA + context.getSessionData(CK.Q_NAME) + GOLD + " -\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("questEditorName") + "\n";
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
text += BLUE + "" + BOLD + "2" + RESET + RED + " - " + Lang.get("questEditorAskMessage") + " " + DARKRED + "(Required, none set)\n";
text += BLUE + "" + BOLD + "2" + RESET + RED + " - " + Lang.get("questEditorAskMessage") + " " + DARKRED + "(" + Lang.get("questRequiredNoneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("questEditorAskMessage") + " (\"" + context.getSessionData(CK.Q_ASK_MESSAGE) + "\")\n";
}
if (context.getSessionData(CK.Q_FINISH_MESSAGE) == null) {
text += BLUE + "" + BOLD + "3" + RESET + RED + " - " + Lang.get("questEditorFinishMessage") + " " + DARKRED + "(Required, none set)\n";
text += BLUE + "" + BOLD + "3" + RESET + RED + " - " + Lang.get("questEditorFinishMessage") + " " + DARKRED + Lang.get("questRequiredNoneSet") + "\n";
} else {
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("questEditorFinishMessage") + " (\"" + context.getSessionData(CK.Q_FINISH_MESSAGE) + "\")\n";
}
if (context.getSessionData(CK.Q_REDO_DELAY) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (None set)\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("questEditorRedoDelay") + " (" + Lang.get("noneSet") + ")\n";
} else {
//something here is throwing an exception
@ -194,7 +195,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (context.getSessionData(CK.Q_START_NPC) == null && quests.citizens != null) {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorNPCStart") + " (None set)\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + Lang.get("noneSet") + ")\n";
} else if (quests.citizens != null) {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorNPCStart") + " (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData(CK.Q_START_NPC)).getName() + ")\n";
}
@ -202,9 +203,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (context.getSessionData(CK.Q_START_BLOCK) == null) {
if (quests.citizens != null) {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (None set)\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (None set)\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("questEditorBlockStart") + " (" + Lang.get("noneSet") + ")\n";
}
} else {
@ -224,19 +225,19 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (context.getSessionData(CK.Q_REGION) == null) {
if (quests.citizens != null) {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set Region (None set)\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Region (None set)\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + Lang.get("noneSet") + ")\n";
}
} else {
if (quests.citizens != null) {
String s = (String) context.getSessionData(CK.Q_REGION);
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set Region (" + GREEN + s + YELLOW + ")\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + GREEN + s + YELLOW + ")\n";
} else {
String s = (String) context.getSessionData(CK.Q_REGION);
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Region (" + GREEN + s + YELLOW + ")\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("questWGSetRegion") + " (" + GREEN + s + YELLOW + ")\n";
}
}
@ -244,9 +245,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} else {
if (quests.citizens != null) {
text += GRAY + "7 - Set Region (WorldGuard not installed)\n";
text += GRAY + "7 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
} else {
text += GRAY + "6 - Set Region (WorldGuard not installed)\n";
text += GRAY + "6 - " + Lang.get("questWGSetRegion") + " (" + Lang.get("questWGNotInstalled") + ")\n";
}
}
@ -254,9 +255,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (context.getSessionData(CK.Q_INITIAL_EVENT) == null) {
if (quests.citizens != null) {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (None set)\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (None set)\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("questEditorInitialEvent") + " (" + Lang.get("noneSet") + ")\n";
}
} else {
@ -274,16 +275,16 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if (quests.citizens != null) {
if(context.getSessionData(CK.Q_GUIDISPLAY) == null) {
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set GUI Item Display (None set)\n";
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("noneSet") + ")\n";
} else {
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set GUI Item Display (" + ItemUtil.getDisplayString(stack) + RESET + YELLOW + ")\n";
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("questEditorSetGUI") + " (" + ItemUtil.getDisplayString(stack) + RESET + YELLOW + ")\n";
}
} else {
text += GRAY + "8 - Set GUI Item Display (Citizens not installed) \n";
text += GRAY + "8 - " + Lang.get("questEditorSetGUI") + " (" + Lang.get("questCitNotInstalled") + ")\n";
}
if (quests.citizens != null) {
@ -437,12 +438,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String s = GOLD + "- Edit Quest -\n";
String s = GOLD + Lang.get("questEditTitle") + "\n";
for (Quest q : quests.getQuests()) {
s += GRAY + "- " + YELLOW + q.getName() + "\n";
}
return s + GOLD + "Enter a Quest to edit, or \"cancel\" to return.";
return s + GOLD + Lang.get("questEditorEditEnterQuestName");
}
@ -492,7 +493,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("questEditorHeader") + " -\n";
String text = GOLD + Lang.get("questCreateTitle") + "\n";
text += AQUA + Lang.get("questEditorCreate") + " " + GOLD + "- " + Lang.get("questEditorEnterQuestName");
return text;
@ -739,9 +740,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- " + Lang.get("event") + " -\n";
String text = DARKGREEN + Lang.get("eventTitle") + "\n";
if (quests.events.isEmpty()) {
text += RED + "- None";
text += RED + "- " + Lang.get("none");
} else {
for (Event e : quests.events) {
text += GREEN + "- " + e.getName() + "\n";
@ -811,7 +812,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
if(ItemUtil.compareItems(stack, quest.guiDisplay, false) != 0) {
context.getForWhom().sendRawMessage(RED + "Error: That item is already being used as the GUI Display for the Quest " + PURPLE + quest.name);
String error = Lang.get("questGUIError");
error = error.replaceAll("<quest>", PURPLE + quest.name + RED);
context.getForWhom().sendRawMessage(RED + error);
failed = true;
break;
@ -828,16 +831,16 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
String text = GREEN + "- GUI Item Display -\n";
String text = GREEN + Lang.get("questGUITitle") + "\n";
if(context.getSessionData(CK.Q_GUIDISPLAY) != null){
ItemStack stack = (ItemStack) context.getSessionData(CK.Q_GUIDISPLAY);
text += DARKGREEN + "Current item: " + RESET + ItemUtil.getDisplayString(stack) + "\n\n";
text += DARKGREEN + Lang.get("questCurrentItem") + " " + RESET + ItemUtil.getDisplayString(stack) + "\n\n";
}else {
text += DARKGREEN + "Current item: " + GRAY + "(None)\n\n";
text += DARKGREEN + Lang.get("questCurrentItem") + " " + GRAY + "(" + Lang.get("none") + ")\n\n";
}
text += GREEN + "" + BOLD + "1 -" + RESET + DARKGREEN + " Set Item\n";
text += GREEN + "" + BOLD + "2 -" + RESET + DARKGREEN + " Clear Item\n";
text += GREEN + "" + BOLD + "3 -" + RESET + GREEN + " Done\n";
text += GREEN + "" + BOLD + "1 -" + RESET + DARKGREEN + " " + Lang.get("questSetItem") + "\n";
text += GREEN + "" + BOLD + "2 -" + RESET + DARKGREEN + " " + Lang.get("questClearItem") + "\n";
text += GREEN + "" + BOLD + "3 -" + RESET + GREEN + " " + Lang.get("done") + "\n";
return text;
@ -855,7 +858,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}else if(input.equalsIgnoreCase("2")) {
context.setSessionData(CK.Q_GUIDISPLAY, null);
context.getForWhom().sendRawMessage(YELLOW + "Quest GUI Item Display cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("questGUICleared"));
return new GUIDisplayPrompt();
}else {
@ -873,7 +876,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = DARKGREEN + "- Quest Region -\n";
String text = DARKGREEN + Lang.get("questRegionTitle") + "\n";
boolean any = false;
for (World world : quests.getServer().getWorlds()) {
@ -892,10 +895,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
text = text.substring(0, text.length() - 2);
text += "\n\n";
} else {
text += GRAY + "(None)\n\n";
text += GRAY + "(" + Lang.get("none") + ")\n\n";
}
return text + YELLOW + "Enter WorldGuard region, or enter \"clear\" to clear the region, or \"cancel\" to return.";
return text + YELLOW + Lang.get("questWGPrompt");
}
@ -928,7 +931,9 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
}
if (found == null) {
player.sendMessage(RED + input + YELLOW + " is not a valid WorldGuard region!");
String error = Lang.get("questWGInvalidRegion");
error = error.replaceAll("<region>", RED + input + YELLOW);
player.sendMessage(RED + error);
return new RegionPrompt();
} else {
context.setSessionData(CK.Q_REGION, found);
@ -937,7 +942,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.Q_REGION, null);
player.sendMessage(YELLOW + "Quest region cleared.");
player.sendMessage(YELLOW + Lang.get("questWGRegionCleared"));
return new CreateMenuPrompt();
} else {
return new CreateMenuPrompt();
@ -992,8 +997,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public String getPromptText(ConversationContext context) {
String text = GREEN
+ "1 - Yes\n"
+ "2 - No";
+ "1 - " + Lang.get("yesWord") + "\n"
+ "2 - " + Lang.get("noWord");
return ChatColor.YELLOW + Lang.get("questEditorSave") + " \"" + AQUA + context.getSessionData(CK.Q_NAME) + YELLOW + "\"?\n" + text;
}
@ -1001,7 +1006,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yes"))) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
if (context.getSessionData(CK.Q_ASK_MESSAGE) == null) {
context.getForWhom().sendRawMessage(RED + Lang.get("questEditorNeedAskMessage"));
@ -1043,7 +1048,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("no"))) {
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt();
} else {
return new SavePrompt();
@ -1058,8 +1063,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
public String getPromptText(ConversationContext context) {
String text = GREEN
+ "1 - " + Lang.get("yes") + "\n"
+ "2 - " + Lang.get("no");
+ "1 - " + Lang.get("yesWord") + "\n"
+ "2 - " + Lang.get("noWord");
return ChatColor.YELLOW + Lang.get("questEditorExited") + "\n" + text;
}
@ -1067,12 +1072,12 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yes"))) {
if (input.equalsIgnoreCase("1") || input.equalsIgnoreCase(Lang.get("yesWord"))) {
context.getForWhom().sendRawMessage(BOLD + "" + YELLOW + Lang.get("exited"));
return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("no"))) {
} else if (input.equalsIgnoreCase("2") || input.equalsIgnoreCase(Lang.get("noWord"))) {
return new CreateMenuPrompt();
} else {
return new ExitPrompt();
@ -2189,7 +2194,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- " + Lang.get("questEditorDelete") + " -\n";
String text = GOLD + Lang.get("questDeleteTitle") + "\n";
for (Quest quest : quests.quests) {
text += AQUA + quest.name + YELLOW + ",";
@ -2252,7 +2257,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
String text
= RED + Lang.get("questEditorDeleted") + " \"" + GOLD + (String) context.getSessionData(CK.ED_QUEST_DELETE) + RED + "\"?\n";
text += YELLOW + Lang.get("yes") + "/" + Lang.get("no");
text += YELLOW + Lang.get("yesWord") + "/" + Lang.get("noWord");
return text;
@ -2261,10 +2266,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase(Lang.get("yes"))) {
if (input.equalsIgnoreCase(Lang.get("yesWord"))) {
deleteQuest(context);
return Prompt.END_OF_CONVERSATION;
} else if (input.equalsIgnoreCase(Lang.get("no"))) {
} else if (input.equalsIgnoreCase(Lang.get("noWord"))) {
return new MenuPrompt();
} else {
return new DeletePrompt();
@ -2281,11 +2286,11 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
data.load(questsFile);
} catch (IOException e) {
e.printStackTrace();
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "Error reading Quests file.");
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile"));
return;
} catch (InvalidConfigurationException e) {
e.printStackTrace();
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "Error reading Quests file.");
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questErrorReadingFile"));
return;
}
@ -2303,13 +2308,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
try {
data.save(questsFile);
} catch (IOException e) {
((Player) context.getForWhom()).sendMessage(ChatColor.RED + "An error occurred while saving.");
((Player) context.getForWhom()).sendMessage(ChatColor.RED + Lang.get("questSaveError"));
return;
}
quests.reloadQuests();
context.getForWhom().sendRawMessage(WHITE + "" + BOLD + "Quest deleted! Quests and Events have been reloaded.");
context.getForWhom().sendRawMessage(WHITE + "" + BOLD + Lang.get("questDeleted"));
}
}

View File

@ -7,6 +7,7 @@ import java.util.Map.Entry;
import java.util.logging.Level;
import me.blackvein.quests.util.ItemUtil;
import me.blackvein.quests.util.Lang;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.Bukkit;
@ -105,12 +106,15 @@ public class Quester {
}
}
player.sendMessage(ChatColor.GREEN + "Quest accepted: " + q.name);
String accepted = Lang.get("questAccepted");
accepted = accepted.replaceAll("<quest>", q.name);
player.sendMessage(ChatColor.GREEN + accepted);
player.sendMessage("");
}
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
player.sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
for (String s : getObjectivesReal()) {
player.sendMessage(s);
@ -174,11 +178,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Damage " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Damage " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("damage") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -196,11 +200,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Break " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Break " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("break") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -218,11 +222,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Place " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Place " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("place") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -240,11 +244,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Use " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Use " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("use") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -262,11 +266,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Cut " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Cut " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("cut") + " " + Quester.prettyItemString(e2.getKey().getId()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -280,11 +284,11 @@ public class Quester {
if (fishCaught < currentStage.fishToCatch) {
unfinishedObjectives.add(ChatColor.GREEN + "Catch Fish: " + fishCaught + "/" + currentStage.fishToCatch);
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("catchFish") + ": " + fishCaught + "/" + currentStage.fishToCatch);
} else {
finishedObjectives.add(ChatColor.GRAY + "Catch Fish: " + fishCaught + "/" + currentStage.fishToCatch);
finishedObjectives.add(ChatColor.GRAY + Lang.get("catchFish") + ": " + fishCaught + "/" + currentStage.fishToCatch);
}
@ -334,11 +338,17 @@ public class Quester {
if (num1 < num2) {
unfinishedObjectives.add(ChatColor.GREEN + "Enchant " + Quester.prettyItemString(mat.getId()) + " with " + Quester.prettyEnchantmentString(enchantment) + ": " + num1 + "/" + num2);
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.getId()));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + num1 + "/" + num2);
} else {
finishedObjectives.add(ChatColor.GRAY + "Enchant " + Quester.prettyItemString(mat.getId()) + " with " + Quester.prettyEnchantmentString(enchantment) + ": " + num1 + "/" + num2);
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", Quester.prettyItemString(mat.getId()));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
finishedObjectives.add(ChatColor.GRAY + obj + ": " + num1 + "/" + num2);
}
@ -357,16 +367,22 @@ public class Quester {
if (mobNumKilled.get(mobsKilled.indexOf(e2)) < currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))) {
if (currentStage.locationsToKillWithin.isEmpty()) {
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + Quester.prettyMobString(e) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("kill") + " " + Quester.prettyMobString(e) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
} else {
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + Quester.prettyMobString(e) + " at " + currentStage.areaNames.get(currentStage.mobsToKill.indexOf(e)) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
String obj = Lang.get("killAtLocation");
obj = obj.replaceAll("<mob>", Quester.prettyMobString(e));
obj = obj.replaceAll("<location>", currentStage.areaNames.get(currentStage.mobsToKill.indexOf(e)));
unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
}
} else {
if (currentStage.locationsToKillWithin.isEmpty()) {
finishedObjectives.add(ChatColor.GRAY + "Kill " + Quester.prettyMobString(e) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
finishedObjectives.add(ChatColor.GRAY + Lang.get("kill") + " " + Quester.prettyMobString(e) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
} else {
finishedObjectives.add(ChatColor.GRAY + "Kill " + Quester.prettyMobString(e) + " at " + currentStage.areaNames.get(currentStage.mobsToKill.indexOf(e)) + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
String obj = Lang.get("killAtLocation");
obj = obj.replaceAll("<mob>", Quester.prettyMobString(e));
obj = obj.replaceAll("<location>", currentStage.areaNames.get(currentStage.mobsToKill.indexOf(e)));
finishedObjectives.add(ChatColor.GRAY + obj + ": " + (mobNumKilled.get(mobsKilled.indexOf(e2))) + "/" + (currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(e))));
}
}
@ -381,11 +397,11 @@ public class Quester {
if (playersKilled < currentStage.playersToKill) {
unfinishedObjectives.add(ChatColor.GREEN + "Kill a Player: " + playersKilled + "/" + currentStage.playersToKill);
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("killPlayer") + ": " + playersKilled + "/" + currentStage.playersToKill);
} else {
finishedObjectives.add(ChatColor.GRAY + "Kill a Player: " + playersKilled + "/" + currentStage.playersToKill);
finishedObjectives.add(ChatColor.GRAY + Lang.get("killPlayer") + ": " + playersKilled + "/" + currentStage.playersToKill);
}
@ -399,11 +415,17 @@ public class Quester {
if (delivered < amt) {
unfinishedObjectives.add(ChatColor.GREEN + "Deliver " + ItemUtil.getName(is) + " to " + plugin.getNPCName(npc) + ": " + delivered + "/" + amt);
String obj = Lang.get("deliver");
obj = obj.replaceAll("<item>", ItemUtil.getName(is));
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc));
unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + delivered + "/" + amt);
} else {
finishedObjectives.add(ChatColor.GRAY + "Deliver " + ItemUtil.getName(is) + " to " + plugin.getNPCName(npc) + ": " + delivered + "/" + amt);
String obj = Lang.get("deliver");
obj = obj.replaceAll("<item>", ItemUtil.getName(is));
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc));
finishedObjectives.add(ChatColor.GRAY + obj + ": " + delivered + "/" + amt);
}
@ -417,11 +439,15 @@ public class Quester {
if (e.getValue() == false) {
unfinishedObjectives.add(ChatColor.GREEN + "Talk to " + plugin.getNPCName(n));
String obj = Lang.get("talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(n));
unfinishedObjectives.add(ChatColor.GREEN + obj);
} else {
finishedObjectives.add(ChatColor.GRAY + "Talk to " + plugin.getNPCName(n));
String obj = Lang.get("talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(n));
finishedObjectives.add(ChatColor.GRAY + obj);
}
@ -439,11 +465,11 @@ public class Quester {
if (citizenNumKilled.get(citizensKilled.indexOf(n2)) < currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n))) {
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + plugin.getNPCName(n) + ChatColor.GREEN + " " + citizenNumKilled.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("kill") + " " + plugin.getNPCName(n) + ChatColor.GREEN + " " + citizenNumKilled.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
} else {
finishedObjectives.add(ChatColor.GRAY + "Kill " + plugin.getNPCName(n) + " " + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
finishedObjectives.add(ChatColor.GRAY + Lang.get("kill") + " " + plugin.getNPCName(n) + " " + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
}
@ -461,11 +487,11 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Tame " + getCapitalized(e.getKey().getName()) + ": " + e2.getValue() + "/" + e.getValue());
unfinishedObjectives.add(ChatColor.GREEN + Lang.get("tame") + " " + getCapitalized(e.getKey().getName()) + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Tame " + getCapitalized(e.getKey().getName()) + ": " + e2.getValue() + "/" + e.getValue());
finishedObjectives.add(ChatColor.GRAY + Lang.get("tame") + " " + getCapitalized(e.getKey().getName()) + ": " + e2.getValue() + "/" + e.getValue());
}
@ -483,11 +509,15 @@ public class Quester {
if (e2.getValue() < e.getValue()) {
unfinishedObjectives.add(ChatColor.GREEN + "Shear " + e.getKey().name().toString().toLowerCase() + " sheep: " + e2.getValue() + "/" + e.getValue());
String obj = Lang.get("shearSheep");
obj = obj.replaceAll("<color>", e.getKey().name().toString().toLowerCase());
unfinishedObjectives.add(ChatColor.GREEN + obj + ": " + e2.getValue() + "/" + e.getValue());
} else {
finishedObjectives.add(ChatColor.GRAY + "Shear " + e.getKey().name().toString().toLowerCase() + " sheep: " + e2.getValue() + "/" + e.getValue());
String obj = Lang.get("shearSheep");
obj = obj.replaceAll("<color>", e.getKey().name().toString().toLowerCase());
finishedObjectives.add(ChatColor.GRAY + obj + ": " + e2.getValue() + "/" + e.getValue());
}
@ -505,11 +535,15 @@ public class Quester {
if (hasReached.get(locationsReached.indexOf(l2)) == false) {
unfinishedObjectives.add(ChatColor.GREEN + "Go to " + currentStage.locationNames.get(currentStage.locationsToReach.indexOf(l)));
String obj = Lang.get("goTo");
obj = obj.replaceAll("<location>", currentStage.locationNames.get(currentStage.locationsToReach.indexOf(l)));
unfinishedObjectives.add(ChatColor.GREEN + obj);
} else {
finishedObjectives.add(ChatColor.GRAY + "Go to " + currentStage.locationNames.get(currentStage.locationsToReach.indexOf(l)));
String obj = Lang.get("goTo");
obj = obj.replaceAll("<location>", currentStage.locationNames.get(currentStage.locationsToReach.indexOf(l)));
finishedObjectives.add(ChatColor.GRAY + obj);
}
@ -856,7 +890,10 @@ public class Quester {
if ((currentTime - killTime) < comparator) {
plugin.getServer().getPlayer(name).sendMessage(ChatColor.RED + "[Quests] Kill did not count. You must wait " + ChatColor.DARK_PURPLE + Quests.getTime(comparator - (currentTime - killTime)) + ChatColor.RED + " before you can kill " + ChatColor.DARK_PURPLE + player + ChatColor.RED + " again.");
String error = Lang.get("killNotValid");
error = error.replaceAll("<time>", ChatColor.DARK_PURPLE + Quests.getTime(comparator - (currentTime - killTime)) + ChatColor.RED);
error = error.replaceAll("<player>", ChatColor.DARK_PURPLE + player + ChatColor.RED);
plugin.getServer().getPlayer(name).sendMessage(ChatColor.RED + error);
return;
}
@ -1052,7 +1089,7 @@ public class Quester {
if (currentStage.objectiveOverride != null) {
if (testComplete()) {
String message = ChatColor.GREEN + "(Completed) " + currentStage.objectiveOverride;
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + currentStage.objectiveOverride;
p.sendMessage(message);
currentQuest.nextStage(this);
}
@ -1062,7 +1099,7 @@ public class Quester {
if (objective.equalsIgnoreCase("password")) {
String message = ChatColor.GREEN + "(Completed) " + pass;
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + pass;
p.sendMessage(message);
if (testComplete()) {
currentQuest.nextStage(this);
@ -1070,7 +1107,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("damageBlock")) {
String message = ChatColor.GREEN + "(Completed) Damage " + prettyItemString(material.getId());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("damage") + " " + prettyItemString(material.getId());
message = message + " " + currentStage.blocksToDamage.get(material) + "/" + currentStage.blocksToDamage.get(material);
p.sendMessage(message);
if (testComplete()) {
@ -1079,7 +1116,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("breakBlock")) {
String message = ChatColor.GREEN + "(Completed) Break " + prettyItemString(material.getId());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("break") + " " + prettyItemString(material.getId());
message = message + " " + currentStage.blocksToBreak.get(material) + "/" + currentStage.blocksToBreak.get(material);
p.sendMessage(message);
if (testComplete()) {
@ -1088,7 +1125,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("placeBlock")) {
String message = ChatColor.GREEN + "(Completed) Place " + prettyItemString(material.getId());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("place") + " " + prettyItemString(material.getId());
message = message + " " + currentStage.blocksToPlace.get(material) + "/" + currentStage.blocksToPlace.get(material);
p.sendMessage(message);
if (testComplete()) {
@ -1097,7 +1134,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("useBlock")) {
String message = ChatColor.GREEN + "(Completed) Use " + prettyItemString(material.getId());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("use") + " " + prettyItemString(material.getId());
message = message + " " + currentStage.blocksToUse.get(material) + "/" + currentStage.blocksToUse.get(material);
p.sendMessage(message);
if (testComplete()) {
@ -1106,7 +1143,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("cutBlock")) {
String message = ChatColor.GREEN + "(Completed) Cut " + prettyItemString(material.getId());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("cut") + " " + prettyItemString(material.getId());
message = message + " " + currentStage.blocksToCut.get(material) + "/" + currentStage.blocksToCut.get(material);
p.sendMessage(message);
if (testComplete()) {
@ -1115,7 +1152,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("catchFish")) {
String message = ChatColor.GREEN + "(Completed) Catch Fish ";
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("catchFish") + " ";
message = message + " " + currentStage.fishToCatch + "/" + currentStage.fishToCatch;
p.sendMessage(message);
if (testComplete()) {
@ -1124,7 +1161,10 @@ public class Quester {
} else if (objective.equalsIgnoreCase("enchantItem")) {
String message = ChatColor.GREEN + "(Completed) Enchant " + prettyItemString(material.getId()) + " with " + Quester.prettyEnchantmentString(enchantment);
String obj = Lang.get("enchantItem");
obj = obj.replaceAll("<item>", prettyItemString(material.getId()));
obj = obj.replaceAll("<enchantment>", Quester.prettyEnchantmentString(enchantment));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
for (Map<Enchantment, Material> map : currentStage.itemsToEnchant.keySet()) {
if (map.containsKey(enchantment)) {
@ -1143,7 +1183,10 @@ public class Quester {
} else if (objective.equalsIgnoreCase("deliverItem")) {
String message = ChatColor.GREEN + "(Completed) Deliver " + ItemUtil.getString(currentStage.itemsToDeliver.get(currentStage.itemsToDeliver.indexOf(itemstack))) + " to " + plugin.getNPCName(currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(itemstack)));
String obj = Lang.get("deliver");
obj = obj.replaceAll("<item>", ItemUtil.getString(currentStage.itemsToDeliver.get(currentStage.itemsToDeliver.indexOf(itemstack))));
obj = obj.replaceAll("<npc>", plugin.getNPCName(currentStage.itemDeliveryTargets.get(currentStage.itemsToDeliver.indexOf(itemstack))));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
p.sendMessage(message);
if (testComplete()) {
currentQuest.nextStage(this);
@ -1151,7 +1194,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("killMob")) {
String message = ChatColor.GREEN + "(Completed) Kill " + mob.getName();
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + mob.getName();
message = message + " " + currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(mob)) + "/" + currentStage.mobNumToKill.get(currentStage.mobsToKill.indexOf(mob));
p.sendMessage(message);
if (testComplete()) {
@ -1160,7 +1203,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("killPlayer")) {
String message = ChatColor.GREEN + "(Completed) Kill a Player";
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("killPlayer");
message = message + " " + currentStage.playersToKill + "/" + currentStage.playersToKill;
p.sendMessage(message);
if (testComplete()) {
@ -1169,7 +1212,9 @@ public class Quester {
} else if (objective.equalsIgnoreCase("talkToNPC")) {
String message = ChatColor.GREEN + "(Completed) Talk to " + npc.getName();
String obj = Lang.get("talkTo");
obj = obj.replaceAll("<npc>", plugin.getNPCName(npc.getId()));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
p.sendMessage(message);
if (testComplete()) {
currentQuest.nextStage(this);
@ -1177,7 +1222,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("killNPC")) {
String message = ChatColor.GREEN + "(Completed) Kill " + npc.getName();
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("kill") + npc.getName();
message = message + " " + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(npc.getId())) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(npc.getId()));
p.sendMessage(message);
if (testComplete()) {
@ -1186,7 +1231,7 @@ public class Quester {
} else if (objective.equalsIgnoreCase("tameMob")) {
String message = ChatColor.GREEN + "(Completed) Tame " + getCapitalized(mob.getName());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + Lang.get("tame") + getCapitalized(mob.getName());
message = message + " " + currentStage.mobsToTame.get(mob) + "/" + currentStage.mobsToTame.get(mob);
p.sendMessage(message);
if (testComplete()) {
@ -1195,7 +1240,9 @@ public class Quester {
} else if (objective.equalsIgnoreCase("shearSheep")) {
String message = ChatColor.GREEN + "(Completed) Shear " + color.name().toString().toLowerCase() + " sheep";
String obj = Lang.get("shearSheep");
obj = obj.replaceAll("<color>", color.name().toString().toLowerCase());
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
message = message + " " + currentStage.sheepToShear.get(color) + "/" + currentStage.sheepToShear.get(color);
p.sendMessage(message);
if (testComplete()) {
@ -1204,7 +1251,9 @@ public class Quester {
} else if (objective.equalsIgnoreCase("reachLocation")) {
String message = ChatColor.GREEN + "(Completed) Go to " + currentStage.locationNames.get(currentStage.locationsToReach.indexOf(location));
String obj = Lang.get("goTo");
obj = obj.replaceAll("<location>", currentStage.locationNames.get(currentStage.locationsToReach.indexOf(location)));
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + obj;
p.sendMessage(message);
if (testComplete()) {
currentQuest.nextStage(this);
@ -1212,7 +1261,7 @@ public class Quester {
} else if (co != null) {
String message = ChatColor.GREEN + "(Completed) " + co.getDisplay();
String message = ChatColor.GREEN + "(" + Lang.get("completed") + ") " + co.getDisplay();
int index = -1;
for (int i = 0; i < currentStage.customObjectives.size(); i++) {
@ -1540,149 +1589,53 @@ public class Quester {
}
public static String capitalsToSpaces(String s) {
for(int i = 1; i < s.length(); i++) {
if(Character.isUpperCase(s.charAt(i))) {
s = s.substring(0, i) + " " + s.substring(i);
}
}
return s;
}
public static String spaceToCapital(String s) {
int index = s.indexOf(' ');
if(index == -1)
return null;
s = s.substring(0, (index + 1)) + Character.toUpperCase(s.charAt(index + 1)) + s.substring(index + 2);
s = s.replaceFirst(" ", "");
return s;
}
public static String prettyEnchantmentString(Enchantment e) {
String prettyString = "";
if (e.equals(Enchantment.ARROW_DAMAGE)) {
prettyString = "Power";
} else if (e.equals(Enchantment.ARROW_FIRE)) {
prettyString = "Flame";
} else if (e.equals(Enchantment.ARROW_INFINITE)) {
prettyString = "Infinity";
} else if (e.equals(Enchantment.ARROW_KNOCKBACK)) {
prettyString = "Punch";
} else if (e.equals(Enchantment.DAMAGE_ALL)) {
prettyString = "Sharpness";
} else if (e.equals(Enchantment.DAMAGE_ARTHROPODS)) {
prettyString = "Bane of Arthropods";
} else if (e.equals(Enchantment.DAMAGE_UNDEAD)) {
prettyString = "Smite";
} else if (e.equals(Enchantment.DIG_SPEED)) {
prettyString = "Efficiency";
} else if (e.equals(Enchantment.DURABILITY)) {
prettyString = "Unbreaking";
} else if (e.equals(Enchantment.FIRE_ASPECT)) {
prettyString = "Fire Aspect";
} else if (e.equals(Enchantment.KNOCKBACK)) {
prettyString = "Knockback";
} else if (e.equals(Enchantment.LOOT_BONUS_BLOCKS)) {
prettyString = "Fortune";
} else if (e.equals(Enchantment.LOOT_BONUS_MOBS)) {
prettyString = "Looting";
} else if (e.equals(Enchantment.OXYGEN)) {
prettyString = "Respiration";
} else if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) {
prettyString = "Protection";
} else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS)) {
prettyString = "Blast Protection";
} else if (e.equals(Enchantment.PROTECTION_FALL)) {
prettyString = "Feather Falling";
} else if (e.equals(Enchantment.PROTECTION_FIRE)) {
prettyString = "Fire Protection";
} else if (e.equals(Enchantment.PROTECTION_PROJECTILE)) {
prettyString = "Projectile Protection";
} else if (e.equals(Enchantment.SILK_TOUCH)) {
prettyString = "Silk Touch";
} else if (e.equals(Enchantment.THORNS)) {
prettyString = "Thorns";
} else if (e.equals(Enchantment.WATER_WORKER)) {
prettyString = "Aqua Affinity";
}
String prettyString = enchantmentString(e);
prettyString = capitalsToSpaces(prettyString);
return prettyString;
}
public static String enchantmentString(Enchantment e) {
String string = "";
if (e.equals(Enchantment.ARROW_DAMAGE)) {
string = "Power";
} else if (e.equals(Enchantment.ARROW_FIRE)) {
string = "Flame";
} else if (e.equals(Enchantment.ARROW_INFINITE)) {
string = "Infinity";
} else if (e.equals(Enchantment.ARROW_KNOCKBACK)) {
string = "Punch";
} else if (e.equals(Enchantment.DAMAGE_ALL)) {
string = "Sharpness";
} else if (e.equals(Enchantment.DAMAGE_ARTHROPODS)) {
string = "BaneOfArthropods";
} else if (e.equals(Enchantment.DAMAGE_UNDEAD)) {
string = "Smite";
} else if (e.equals(Enchantment.DIG_SPEED)) {
string = "Efficiency";
} else if (e.equals(Enchantment.DURABILITY)) {
string = "Unbreaking";
} else if (e.equals(Enchantment.FIRE_ASPECT)) {
string = "FireAspect";
} else if (e.equals(Enchantment.KNOCKBACK)) {
string = "Knockback";
} else if (e.equals(Enchantment.LOOT_BONUS_BLOCKS)) {
string = "Fortune";
} else if (e.equals(Enchantment.LOOT_BONUS_MOBS)) {
string = "Looting";
} else if (e.equals(Enchantment.OXYGEN)) {
string = "Respiration";
} else if (e.equals(Enchantment.PROTECTION_ENVIRONMENTAL)) {
string = "Protection";
} else if (e.equals(Enchantment.PROTECTION_EXPLOSIONS)) {
string = "BlastProtection";
} else if (e.equals(Enchantment.PROTECTION_FALL)) {
string = "FeatherFalling";
} else if (e.equals(Enchantment.PROTECTION_FIRE)) {
string = "FireProtection";
} else if (e.equals(Enchantment.PROTECTION_PROJECTILE)) {
string = "ProjectileProtection";
} else if (e.equals(Enchantment.SILK_TOUCH)) {
string = "SilkTouch";
} else if (e.equals(Enchantment.THORNS)) {
string = "Thorns";
} else if (e.equals(Enchantment.WATER_WORKER)) {
string = "AquaAffinity";
}
return string;
return(Lang.get("ENCHANTMENT_" + e.getName()));
}
public static String prettyColorString(DyeColor color) {
if (color.equals(DyeColor.BLACK)) {
return "Black";
} else if (color.equals(DyeColor.BLUE)) {
return "Blue";
} else if (color.equals(DyeColor.BROWN)) {
return "Brown";
} else if (color.equals(DyeColor.CYAN)) {
return "Cyan";
} else if (color.equals(DyeColor.GRAY)) {
return "Gray";
} else if (color.equals(DyeColor.GREEN)) {
return "Green";
} else if (color.equals(DyeColor.LIGHT_BLUE)) {
return "LightBlue";
} else if (color.equals(DyeColor.LIME)) {
return "Lime";
} else if (color.equals(DyeColor.MAGENTA)) {
return "Magenta";
} else if (color.equals(DyeColor.ORANGE)) {
return "Orange";
} else if (color.equals(DyeColor.PINK)) {
return "Pink";
} else if (color.equals(DyeColor.PURPLE)) {
return "Purple";
} else if (color.equals(DyeColor.RED)) {
return "Red";
} else if (color.equals(DyeColor.SILVER)) {
return "Silver";
} else if (color.equals(DyeColor.WHITE)) {
return "White";
} else {
return "Yellow";
}
return Lang.get("COLOR_" + color.name());
}
@ -2319,91 +2272,7 @@ public class Quester {
for (String s : enchantNames) {
if (s.equalsIgnoreCase("Power")) {
enchantments.add(Enchantment.ARROW_DAMAGE);
} else if (s.equalsIgnoreCase("Flame")) {
enchantments.add(Enchantment.ARROW_FIRE);
} else if (s.equalsIgnoreCase("Infinity")) {
enchantments.add(Enchantment.ARROW_INFINITE);
} else if (s.equalsIgnoreCase("Punch")) {
enchantments.add(Enchantment.ARROW_KNOCKBACK);
} else if (s.equalsIgnoreCase("Sharpness")) {
enchantments.add(Enchantment.DAMAGE_ALL);
} else if (s.equalsIgnoreCase("BaneOfArthropods")) {
enchantments.add(Enchantment.DAMAGE_ARTHROPODS);
} else if (s.equalsIgnoreCase("Smite")) {
enchantments.add(Enchantment.DAMAGE_UNDEAD);
} else if (s.equalsIgnoreCase("Efficiency")) {
enchantments.add(Enchantment.DIG_SPEED);
} else if (s.equalsIgnoreCase("Unbreaking")) {
enchantments.add(Enchantment.DURABILITY);
} else if (s.equalsIgnoreCase("FireAspect")) {
enchantments.add(Enchantment.FIRE_ASPECT);
} else if (s.equalsIgnoreCase("Knockback")) {
enchantments.add(Enchantment.KNOCKBACK);
} else if (s.equalsIgnoreCase("Fortune")) {
enchantments.add(Enchantment.LOOT_BONUS_BLOCKS);
} else if (s.equalsIgnoreCase("Looting")) {
enchantments.add(Enchantment.LOOT_BONUS_MOBS);
} else if (s.equalsIgnoreCase("Respiration")) {
enchantments.add(Enchantment.OXYGEN);
} else if (s.equalsIgnoreCase("Protection")) {
enchantments.add(Enchantment.PROTECTION_ENVIRONMENTAL);
} else if (s.equalsIgnoreCase("BlastProtection")) {
enchantments.add(Enchantment.PROTECTION_EXPLOSIONS);
} else if (s.equalsIgnoreCase("FeatherFalling")) {
enchantments.add(Enchantment.PROTECTION_FALL);
} else if (s.equalsIgnoreCase("FireProtection")) {
enchantments.add(Enchantment.PROTECTION_FIRE);
} else if (s.equalsIgnoreCase("ProjectileProtection")) {
enchantments.add(Enchantment.PROTECTION_PROJECTILE);
} else if (s.equalsIgnoreCase("SilkTouch")) {
enchantments.add(Enchantment.SILK_TOUCH);
} else if (s.equalsIgnoreCase("AquaAffinity")) {
enchantments.add(Enchantment.WATER_WORKER);
}
enchantments.add(Quests.getEnchantment(s));
materials.add(Material.getMaterial(ids.get(enchantNames.indexOf(s))));
amounts.add(enchantNames.indexOf(s));
@ -2585,85 +2454,7 @@ public class Quester {
for (String color : colors) {
if (color.equalsIgnoreCase("Black")) {
sheepSheared.put(DyeColor.BLACK, amounts.get(colors.indexOf(color)));
} else if (color.equalsIgnoreCase("Blue")) {
sheepSheared.put(DyeColor.BLUE, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Brown")) {
sheepSheared.put(DyeColor.BROWN, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Cyan")) {
sheepSheared.put(DyeColor.CYAN, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Gray")) {
sheepSheared.put(DyeColor.GRAY, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Green")) {
sheepSheared.put(DyeColor.GREEN, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("LightBlue")) {
sheepSheared.put(DyeColor.LIGHT_BLUE, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Lime")) {
sheepSheared.put(DyeColor.LIME, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Magenta")) {
sheepSheared.put(DyeColor.MAGENTA, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Orange")) {
sheepSheared.put(DyeColor.ORANGE, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Pink")) {
sheepSheared.put(DyeColor.PINK, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Purple")) {
sheepSheared.put(DyeColor.PURPLE, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Red")) {
sheepSheared.put(DyeColor.RED, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Silver")) {
sheepSheared.put(DyeColor.SILVER, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("White")) {
sheepSheared.put(DyeColor.WHITE, amounts.get(colors.indexOf(color)));
}
if (color.equalsIgnoreCase("Yellow")) {
sheepSheared.put(DyeColor.YELLOW, amounts.get(colors.indexOf(color)));
}
sheepSheared.put(Quests.getDyeColor(color), amounts.get(colors.indexOf(color)));
}
@ -2791,7 +2582,9 @@ public class Quester {
currentStageIndex = 0;
resetObjectives();
if (plugin.getServer().getPlayer(name) != null) {
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "Your active Quest " + ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED + " has been modified. You have been forced to quit the Quest.");
String error = Lang.get("questModified");
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED);
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
}
currentQuest = null;
@ -2809,7 +2602,9 @@ public class Quester {
currentStageIndex = 0;
resetObjectives();
if (plugin.getServer().getPlayer(name) != null) {
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "Your active Quest " + ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED + " no longer exists. You have been forced to quit the Quest.");
String error = Lang.get("questNotExist");
error = error.replaceAll("<quest>", ChatColor.DARK_PURPLE + currentQuest.name + ChatColor.RED);
plugin.getServer().getPlayer(name).sendMessage(ChatColor.GOLD + "[Quests] " + ChatColor.RED + error);
}
currentQuest = null;
@ -2822,7 +2617,7 @@ public class Quester {
public static String checkPlacement(Inventory inv, int rawSlot) {
if (rawSlot < 0) {
return "You may not drop Quest items.";
return Lang.get("questNoDrop");
}
InventoryType type = inv.getType();
@ -2830,19 +2625,19 @@ public class Quester {
if (type.equals(InventoryType.BREWING)) {
if (rawSlot < 4) {
return "You may not brew using Quest items.";
return Lang.get("questNoBrew");
}
} else if (type.equals(InventoryType.CHEST)) {
if (inv.getContents().length == 27) {
if (rawSlot < 27) {
return "You may not store Quest items.";
return Lang.get("questNoStore");
}
} else {
if (rawSlot < 54) {
return "You may not store Quest items.";
return Lang.get("questNoStore");
}
}
@ -2850,39 +2645,39 @@ public class Quester {
} else if (type.equals(InventoryType.CRAFTING)) {
if (rawSlot < 5) {
return "You may not craft using Quest items.";
return Lang.get("questNoCraft");
} else if (rawSlot < 9) {
return "You may not equip Quest items.";
return Lang.get("questNoEquip");
}
} else if (type.equals(InventoryType.DISPENSER)) {
if (rawSlot < 9) {
return "You may not put Quest items in dispensers.";
return Lang.get("questNoDispense");
}
} else if (type.equals(InventoryType.ENCHANTING)) {
if (rawSlot == 0) {
return "You may not enchant Quest items.";
return Lang.get("questNoEnchant");
}
} else if (type.equals(InventoryType.ENDER_CHEST)) {
if (rawSlot < 27) {
return "You may not store Quest items.";
return Lang.get("questNoStore");
}
} else if (type.equals(InventoryType.FURNACE)) {
if (rawSlot < 3) {
return "You may not smelt using Quest items.";
return Lang.get("questNoSmelt");
}
} else if (type.equals(InventoryType.WORKBENCH)) {
if (rawSlot < 10) {
return "You may not craft using Quest items.";
return Lang.get("questNoCraft");
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
package me.blackvein.quests;
import me.blackvein.quests.util.Lang;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@ -46,7 +47,7 @@ public class StageTimer implements Runnable{
quester.delayStartTime = 0;
quester.delayTimeLeft = -1;
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
player.sendMessage(ChatColor.GOLD + Lang.get("questObjectivesTitle"));
for(String s : quester.getObjectivesReal()){
player.sendMessage(s);

View File

@ -4,8 +4,8 @@ import me.blackvein.quests.Quest;
public class InvalidStageException extends Exception {
private Quest quest;
private int stage;
private final Quest quest;
private final int stage;
public InvalidStageException(Quest quest, int stage) {
this.quest = quest;
@ -20,9 +20,6 @@ public class InvalidStageException extends Exception {
return stage;
}
/**
*
*/
private static final long serialVersionUID = 1778748295752972651L;
@Override

View File

@ -18,6 +18,7 @@ import me.blackvein.quests.util.Lang;
import me.blackvein.quests.util.MiscUtil;
import net.aufdemrand.denizen.scripts.ScriptRegistry;
import net.citizensnpcs.api.CitizensPlugin;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Material;
@ -28,6 +29,7 @@ import org.bukkit.conversations.NumericPrompt;
import org.bukkit.conversations.Prompt;
import org.bukkit.conversations.StringPrompt;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@ -150,7 +152,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LinkedList<Integer> amnts = (LinkedList<Integer>) context.getSessionData(pref + CK.S_ENCHANT_AMOUNTS);
for (int i = 0; i < enchants.size(); i++) {
text += GRAY + " - " + BLUE + Quester.prettyItemString(items.get(i)) + GRAY + " with " + AQUA + Quester.prettyString(enchants.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n";
text += GRAY + " - " + BLUE + Quester.prettyItemString(items.get(i)) + GRAY + " " + Lang.get("with") + " " + AQUA + Quester.prettyString(enchants.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + "\n";
}
}
@ -166,13 +168,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(pref + CK.S_DELIVERY_ITEMS);
for (int i = 0; i < npcs.size(); i++) {
text += GRAY + " - " + BLUE + ItemUtil.getName(items.get(i)) + GRAY + " x " + AQUA + items.get(i).getAmount() + GRAY + " to " + DARKAQUA + citizens.getNPCRegistry().getById(npcs.get(i)).getName() + "\n";
text += GRAY + " - " + BLUE + ItemUtil.getName(items.get(i)) + GRAY + " x " + AQUA + items.get(i).getAmount() + GRAY + " " + Lang.get("to") + " " + DARKAQUA + citizens.getNPCRegistry().getById(npcs.get(i)).getName() + "\n";
}
}
} else {
text += GRAY + "" + BOLD + "9 " + RESET + GRAY + "- " + Lang.get("stageEditorDeliverItems") + GRAY + " (Citizens not installed)\n";
text += GRAY + "" + BOLD + "9 " + RESET + GRAY + "- " + Lang.get("stageEditorDeliverItems") + GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
}
if (questFactory.quests.citizens != null) {
@ -191,7 +193,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
} else {
text += GRAY + "" + BOLD + "10 " + RESET + GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + GRAY + " (Citizens not installed)\n";
text += GRAY + "" + BOLD + "10 " + RESET + GRAY + "- " + Lang.get("stageEditorTalkToNPCs") + GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
}
if (questFactory.quests.citizens != null) {
@ -211,7 +213,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
} else {
text += GRAY + "" + BOLD + "11 " + RESET + GRAY + "- " + Lang.get("stageEditorKillNPCs") + GRAY + " (Citizens not installed)\n";
text += GRAY + "" + BOLD + "11 " + RESET + GRAY + "- " + Lang.get("stageEditorKillNPCs") + GRAY + " (" + Lang.get("questCitNotInstalled") + ")\n";
}
if (context.getSessionData(pref + CK.S_MOB_TYPES) == null) {
@ -235,7 +237,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
LinkedList<String> names = (LinkedList<String>) context.getSessionData(pref + CK.S_MOB_KILL_LOCATIONS_NAMES);
for (int i = 0; i < mobs.size(); i++) {
text += GRAY + " - " + BLUE + Quester.prettyString(mobs.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + GRAY + " within " + PURPLE + radii.get(i) + GRAY + " blocks of " + YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
String msg = Lang.get("blocksWithin");
msg = msg.replaceAll("<amount>", PURPLE + "" + radii.get(i) + GRAY);
text += GRAY + " - " + BLUE + Quester.prettyString(mobs.get(i)) + GRAY + " x " + DARKAQUA + amnts.get(i) + GRAY + msg + YELLOW + names.get(i) + " (" + locs.get(i) + ")\n";
}
}
@ -304,7 +308,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (questFactory.quests.denizen == null) {
text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- " + Lang.get("stageEditorDenizenScript") + GRAY + " (Denizen not installed)\n";
text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- " + Lang.get("stageEditorDenizenScript") + GRAY + " (" + Lang.get("questDenNotInstalled") + ")\n";
} else {
if (context.getSessionData(pref + CK.S_DENIZEN) == null) {
@ -316,11 +320,11 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- Password Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- " + Lang.get("stageEditorPassword") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
LinkedList<LinkedList<String>> passPhrases = (LinkedList<LinkedList<String>>) context.getSessionData(pref + CK.S_PASSWORD_PHRASES);
LinkedList<String> passDisplays = (LinkedList<String>) context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS);
text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- Password Objectives\n";
text += PINK + "" + BOLD + "20 " + RESET + PURPLE + "- " + Lang.get("stageEditorPassword") + "\n";
for(int i = 0; i < passPhrases.size(); i++){
text += AQUA + " - \"" + passDisplays.get(i) + "\"\n";
LinkedList<String> phrases = passPhrases.get(i);
@ -330,10 +334,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES) == null) {
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- Custom Objectives" + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- " + Lang.get("stageEditorCustom") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
LinkedList<String> customObjs = (LinkedList<String>) context.getSessionData(pref + CK.S_CUSTOM_OBJECTIVES);
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- Custom Objectives\n";
text += PINK + "" + BOLD + "21 " + RESET + PINK + "- " + Lang.get("stageEditorCustom") + "\n";
for(String s : customObjs){
text += PINK + " - " + GOLD + s + "\n";
}
@ -352,9 +356,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) == null) {
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- Objective Display Override " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- " + Lang.get("stageObjectiveOverride") + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- Objective Display Override " + GRAY + "(" + DARKAQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + GRAY + ")\n";
text += PINK + "" + BOLD + "24 " + RESET + PURPLE + "- " + Lang.get("stageObjectiveOverride") + GRAY + "(" + DARKAQUA + "\"" + context.getSessionData(pref + CK.S_OVERRIDE_DISPLAY) + "\"" + GRAY + ")\n";
}
text += RED + "" + BOLD + "25 " + RESET + PURPLE + "- " + Lang.get("stageEditorDelete") + "\n";
@ -461,15 +465,15 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- Password Objectives -\n";
String text = GOLD + "- " + Lang.get("stageEditorPassword") + "-\n";
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add password display (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + "Add password phrase(s) (No password displays set)\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddPasswordDisplay") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("stageEditorNoPasswordDisplays") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
} else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add password display\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorAddPasswordDisplay") + "\n";
for (String display : getPasswordDisplays(context)) {
text += GRAY + " - " + AQUA + display + "\n";
@ -477,10 +481,10 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(pref + CK.S_PASSWORD_PHRASES) == null) {
text += YELLOW + "2 - " + "Add password phrase(s) (" + Lang.get("noneSet") + ")\n";
text += YELLOW + "2 - " + Lang.get("stageEditorAddPasswordPhrases") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += YELLOW + "2 - " + "Add password phrase(s)\n";
text += YELLOW + "2 - " + Lang.get("stageEditorAddPasswordPhrases") + "\n";
for (LinkedList<String> phraseList : getPasswordPhrases(context)) {
text += GRAY + " - ";
@ -511,13 +515,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new PasswordDisplayPrompt();
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) == null) {
context.getForWhom().sendRawMessage(RED + "You must add at least one password display first!");
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorMustSetPasswordDisplays"));
return new PasswordListPrompt();
} else {
return new PasswordPhrasePrompt();
}
} else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "Password Objectives cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorAddPasswordCleared"));
context.setSessionData(pref + CK.S_PASSWORD_DISPLAYS, null);
context.setSessionData(pref + CK.S_PASSWORD_PHRASES, null);
return new PasswordListPrompt();
@ -541,7 +545,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (one == two) {
return new CreateStagePrompt(stageNum, questFactory, citizens);
} else {
context.getForWhom().sendRawMessage(RED + "The password display and password phrase lists are not the same size!");
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorPasswordNotSameSize"));
return new PasswordListPrompt();
}
}
@ -564,8 +568,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = YELLOW + "Enter a password display, or 'cancel' to return\n";
text += ITALIC + "" + GOLD + "(This is the text that will be displayed to the player as their objective)";
String text = YELLOW + Lang.get("stageEditorPasswordDisplayPrompt") + "\n";
text += ITALIC + "" + GOLD + Lang.get("stageEditorPasswordDisplayHint");
return text;
@ -574,7 +578,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if(context.getSessionData(pref + CK.S_PASSWORD_DISPLAYS) != null) {
@ -603,9 +607,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = YELLOW + "Enter a password phrase, or 'cancel' to return\n";
text += ITALIC + "" + GOLD + "(This is the text that a player has to say to complete the objective)\n";
text += RESET + "" + YELLOW + "If you want multiple password phrases, seperate them by a | (pipe)";
String text = YELLOW + Lang.get("stageEditorPasswordPhrasePrompt") + "\n";
text += ITALIC + "" + GOLD + Lang.get("stageEditorPasswordPhraseHint1") + "\n";
text += RESET + "" + YELLOW + Lang.get("stageEditorPasswordPhraseHint2");
return text;
@ -614,7 +618,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
if(context.getSessionData(pref + CK.S_PASSWORD_PHRASES) != null) {
@ -647,8 +651,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = YELLOW + "Enter objective display override, or 'clear' to clear the override, or 'cancel' to return.\n";
text += ITALIC + "" + GOLD + "(The objective display override will show up as the players current objective)";
String text = YELLOW + Lang.get("stageEditorObjectiveOverridePrompt") + "\n";
text += ITALIC + "" + GOLD + Lang.get("stageEditorObjectiveOverrideHint");
return text;
@ -657,14 +661,14 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, input);
}else if(input.equalsIgnoreCase("clear")) {
}else if(input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_OVERRIDE_DISPLAY, null);
context.getForWhom().sendRawMessage(YELLOW + "Objective display override cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorObjectiveOverrideCleared"));
}
@ -1258,7 +1262,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- Use Blocks -\n";
String text = GOLD + "- " + Lang.get("stageEditorUseBlocks") + " -\n";
if (context.getSessionData(pref + CK.S_USE_IDS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("stageEditorSetBlockIds") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("stageEditorSetUseAmounts") + " (" + Lang.get("noIdsSet") + ")\n";
@ -2039,7 +2043,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(pref + CK.S_DELIVERY_MESSAGES) == null) {
text += BLUE + "3 - Set delivery messages (" + Lang.get("noneSet") + ")\n";
text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "3 - " + Lang.get("stageEditorDeliveryMessages") + "\n";
@ -2182,7 +2186,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
public String getPromptText(ConversationContext context) {
String note = GOLD + Lang.get("stageEditorNPCNote");
return YELLOW + Lang.get("stageEditorDeliveryMessagesPrompt") + ".\n" + note;
return YELLOW + Lang.get("stageEditorDeliveryMessagesPrompt") + "\n" + note;
}
@Override
@ -2675,36 +2679,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String mobs = PINK + "- Mobs - \n";
mobs += PURPLE + "Bat, ";
mobs += PURPLE + "Blaze, ";
mobs += PURPLE + "CaveSpider, ";
mobs += PURPLE + "Chicken, ";
mobs += PURPLE + "Cow, ";
mobs += PURPLE + "Creeper, ";
mobs += PURPLE + "Enderman, ";
mobs += PURPLE + "EnderDragon, ";
mobs += PURPLE + "Ghast, ";
mobs += PURPLE + "Giant, ";
mobs += PURPLE + "Horse, ";
mobs += PURPLE + "IronGolem, ";
mobs += PURPLE + "MagmaCube, ";
mobs += PURPLE + "MushroomCow, ";
mobs += PURPLE + "Ocelot, ";
mobs += PURPLE + "Pig, ";
mobs += PURPLE + "PigZombie, ";
mobs += PURPLE + "Sheep, ";
mobs += PURPLE + "Silverfish, ";
mobs += PURPLE + "Skeleton, ";
mobs += PURPLE + "Slime, ";
mobs += PURPLE + "Snowman, ";
mobs += PURPLE + "Spider, ";
mobs += PURPLE + "Squid, ";
mobs += PURPLE + "Villager, ";
mobs += PURPLE + "Witch, ";
mobs += PURPLE + "Wither, ";
mobs += PURPLE + "Wolf, ";
mobs += PURPLE + "Zombie\n";
String mobs = PINK + Lang.get("eventEditorMobsTitle") + "\n";
final EntityType[] mobArr = EntityType.values();
for(int i = 0; i < mobArr.length; i++) {
final EntityType type = mobArr[i];
if(type.isAlive() == false)
continue;
if(i < (mobArr.length - 1)) {
mobs += MiscUtil.getProperMobName(mobArr[i]) + ", ";
} else {
mobs += MiscUtil.getProperMobName(mobArr[i]) + "\n";
}
}
return mobs + YELLOW + Lang.get("stageEditorMobsPrompt");
@ -2978,20 +2966,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
return new ReachLocationPrompt();
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
context.getForWhom().sendRawMessage(RED + "You must set locations first!");
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoLocations"));
return new ReachListPrompt();
} else {
return new ReachRadiiPrompt();
}
} else if (input.equalsIgnoreCase("3")) {
if (context.getSessionData(pref + CK.S_REACH_LOCATIONS) == null) {
context.getForWhom().sendRawMessage(RED + "You must set locations first!");
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoLocations"));
return new ReachListPrompt();
} else {
return new ReachNamesPrompt();
}
} else if (input.equalsIgnoreCase("4")) {
context.getForWhom().sendRawMessage(YELLOW + "Reach Locations objective cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorReachLocationsCleared"));
context.setSessionData(pref + CK.S_REACH_LOCATIONS, null);
context.setSessionData(pref + CK.S_REACH_LOCATIONS_RADIUS, null);
context.setSessionData(pref + CK.S_REACH_LOCATIONS_NAMES, null);
@ -3023,7 +3011,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if (one == two && two == three) {
return new CreateStagePrompt(stageNum, questFactory, citizens);
} else {
context.getForWhom().sendRawMessage(RED + "All of your lists are not the same size!");
context.getForWhom().sendRawMessage(RED + Lang.get("allListsNotSameSize"));
return new ReachListPrompt();
}
@ -3278,35 +3266,21 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String mobs = PINK + "- Mobs - \n";
mobs += PURPLE + "Bat, ";
mobs += PURPLE + "Blaze, ";
mobs += PURPLE + "CaveSpider, ";
mobs += PURPLE + "Chicken, ";
mobs += PURPLE + "Cow, ";
mobs += PURPLE + "Creeper, ";
mobs += PURPLE + "Enderman, ";
mobs += PURPLE + "EnderDragon, ";
mobs += PURPLE + "Ghast, ";
mobs += PURPLE + "Giant, ";
mobs += PURPLE + "IronGolem, ";
mobs += PURPLE + "MagmaCube, ";
mobs += PURPLE + "MushroomCow, ";
mobs += PURPLE + "Ocelot, ";
mobs += PURPLE + "Pig, ";
mobs += PURPLE + "PigZombie, ";
mobs += PURPLE + "Sheep, ";
mobs += PURPLE + "Silverfish, ";
mobs += PURPLE + "Skeleton, ";
mobs += PURPLE + "Slime, ";
mobs += PURPLE + "Snowman, ";
mobs += PURPLE + "Spider, ";
mobs += PURPLE + "Squid, ";
mobs += PURPLE + "Villager, ";
mobs += PURPLE + "Witch, ";
mobs += PURPLE + "Wither, ";
mobs += PURPLE + "Wolf, ";
mobs += PURPLE + "Zombie\n";
String mobs = PINK + Lang.get("eventEditorMobsTitle") + "\n";
final EntityType[] mobArr = EntityType.values();
for(int i = 0; i < mobArr.length; i++) {
final EntityType type = mobArr[i];
if(type.isAlive() == false)
continue;
if(i < (mobArr.length - 1)) {
mobs += MiscUtil.getProperMobName(mobArr[i]) + ", ";
} else {
mobs += MiscUtil.getProperMobName(mobArr[i]) + "\n";
}
}
return mobs + YELLOW + Lang.get("stageEditorMobsPrompt");
@ -3496,25 +3470,20 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String mobs = PINK + "- " + Lang.get("stageEditorColors") + " - \n";
mobs += PURPLE + "Black, ";
mobs += PURPLE + "Blue, ";
mobs += PURPLE + "Brown, ";
mobs += PURPLE + "Cyan, ";
mobs += PURPLE + "Gray, ";
mobs += PURPLE + "Green, ";
mobs += PURPLE + "LightBlue, ";
mobs += PURPLE + "Lime, ";
mobs += PURPLE + "Magenta, ";
mobs += PURPLE + "Orange, ";
mobs += PURPLE + "Pink, ";
mobs += PURPLE + "Purple, ";
mobs += PURPLE + "Red, ";
mobs += PURPLE + "Silver, ";
mobs += PURPLE + "White, ";
mobs += PURPLE + "Yellow\n";
String cols = PINK + "- " + Lang.get("stageEditorColors") + " - \n";
final DyeColor[] colArr = DyeColor.values();
for(int i = 0; i < colArr.length; i++) {
return mobs + YELLOW + Lang.get("stageEditorShearColorsPrompt");
final DyeColor col = colArr[i];
if(i < (colArr.length - 1)) {
cols += Quests.getDyeString(colArr[i]) + ", ";
} else {
cols += Quests.getDyeString(colArr[i]) + "\n";
}
}
return cols + YELLOW + Lang.get("stageEditorShearColorsPrompt");
}
@ -3744,7 +3713,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
String text = DARKGREEN + "- " + Lang.get("stageEditorFinishEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
text += RED + "- " + Lang.get("none");
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
@ -3858,7 +3827,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
String text = DARKGREEN + "- " + Lang.get("stageEditorDisconnectEvent") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
text += RED + "- " + Lang.get("none");
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
@ -3915,7 +3884,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
String text = DARKGREEN + "- " + Lang.get("stageEditorChatEvents") + " -\n";
if (questFactory.quests.events.isEmpty()) {
text += RED + "- None";
text += RED + "- " + Lang.get("none");
} else {
for (Event e : questFactory.quests.events) {
text += GREEN + "- " + e.getName() + "\n";
@ -4044,7 +4013,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}
if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_DELAY, null);
player.sendMessage(GREEN + "Delay cleared.");
player.sendMessage(GREEN + Lang.get("stageEditorDelayCleared"));
return new CreateStagePrompt(stageNum, questFactory, citizens);
}
@ -4096,7 +4065,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_DELAY_MESSAGE, null);
player.sendMessage(YELLOW + "Delay message cleared.");
player.sendMessage(YELLOW + Lang.get("stageEditorDelayMessageCleared"));
return new CreateStagePrompt(stageNum, questFactory, citizens);
} else {
return new DelayMessagePrompt();
@ -4141,7 +4110,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_DENIZEN, null);
player.sendMessage(YELLOW + "Denizen script cleared.");
player.sendMessage(YELLOW + Lang.get("stageEditorDenizenCleared"));
return new CreateStagePrompt(stageNum, questFactory, citizens);
} else {
return new CreateStagePrompt(stageNum, questFactory, citizens);
@ -4155,8 +4124,8 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GREEN + "" + BOLD + "1" + RESET + "" + GREEN + " - " + Lang.get("yes") + "\n";
text += GREEN + "" + BOLD + "2" + RESET + "" + GREEN + " - " + Lang.get("no");
String text = GREEN + "" + BOLD + "1" + RESET + "" + GREEN + " - " + Lang.get("yesWord") + "\n";
text += GREEN + "" + BOLD + "2" + RESET + "" + GREEN + " - " + Lang.get("noWord");
return RED + Lang.get("stageEditorConfirmStageDelete") + "\n" + YELLOW + Lang.get("stageEditorStage") + " " + stageNum + ": " + context.getSessionData(CK.Q_NAME) + RED + "\n(" + Lang.get("stageEditorConfirmStageNote") + ")\n" + text;
}
@ -4214,7 +4183,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + Lang.get("Enter complete message, or enter \"clear\" to clear the message, or \"cancel\" to return");
return YELLOW + Lang.get("stageEditorCompleteMessagePrompt");
}
@ -4242,21 +4211,21 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = PINK + "- Custom Objectives -\n";
String text = PINK + "- " + Lang.get("stageEditorCustom") + " -\n";
if(questFactory.quests.customObjectives.isEmpty()){
text += BOLD + "" + PURPLE + "(No modules loaded)";
text += BOLD + "" + PURPLE + "(" + Lang.get("stageEditorNoModules") + ")";
}else {
for(CustomObjective co : questFactory.quests.customObjectives)
text += PURPLE + " - " + co.getName() + "\n";
}
return text + YELLOW + "Enter the name of a custom objective to add, or enter \'clear\' to clear all custom objectives, or \'cancel\' to return.";
return text + YELLOW + Lang.get("stageEditorCustomPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomObjective found = null;
for(CustomObjective co : questFactory.quests.customObjectives){
@ -4288,7 +4257,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, list);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, datamapList);
}else{
context.getForWhom().sendRawMessage(YELLOW + "That custom objective has already been added!");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCustomAlreadyAdded"));
return new CustomObjectivesPrompt();
}
}else{
@ -4317,15 +4286,15 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
//
}else{
context.getForWhom().sendRawMessage(YELLOW + "Custom objective module not found.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorModuleNotFound"));
return new CustomObjectivesPrompt();
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA, null);
context.setSessionData(pref + CK.S_CUSTOM_OBJECTIVES_DATA_TEMP, null);
context.getForWhom().sendRawMessage(YELLOW + "Custom objectives cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("stageEditorCustomCleared"));
}
return new CreateStagePrompt(stageNum, questFactory, citizens);
@ -4394,7 +4363,7 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
}catch (NumberFormatException e){
context.getForWhom().sendRawMessage(RED + "Input was not a number!");
context.getForWhom().sendRawMessage(RED + Lang.get("stageEditorNoNumber"));
return new CustomObjectiveCountPrompt();
}
@ -4431,13 +4400,13 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if(datamap.get(dataKey) != null)
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
else
text += RED + " (Value required)\n";
text += RED + " (" + Lang.get("valRequired") + ")\n";
index++;
}
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + "Finish";
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + Lang.get("finish");
return text;
}
@ -4495,8 +4464,9 @@ public class CreateStagePrompt extends FixedSetPrompt implements ColorUtil {
if(descriptions.get(temp) != null)
text += GOLD + descriptions.get(temp) + "\n";
text += YELLOW + "Enter value for ";
text += BOLD + temp + RESET + YELLOW + ":";
String msg = Lang.get("stageEditorCustomDataPrompt");
msg = msg.replaceAll("<data>", BOLD + temp + RESET + YELLOW);
text += YELLOW + msg;
return text;
}

View File

@ -7,12 +7,11 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.crypto.Data;
import me.blackvein.quests.ItemData;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.util.Lang;
import org.bukkit.ChatColor;
import org.bukkit.Material;
@ -45,22 +44,22 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
String menu = YELLOW + "- " + GOLD + "Create Item " + YELLOW + "-\n";
String menu = YELLOW + Lang.get("createItemTitle") + "\n";
if(cc.getSessionData("tempId") != null){
String stackData = getItemData(cc);
if(stackData != null)
menu += stackData;
}else
menu += "\n";
menu += GOLD + "" + BOLD + "0. " + RESET + "" + YELLOW + "Load item in hand\n";
menu += YELLOW + "" + BOLD + "1. " + RESET + "" + GOLD + "Set ID\n";
menu += YELLOW + "" + BOLD + "2. " + RESET + "" + GOLD + "Set amount\n";
menu += YELLOW + "" + BOLD + "3. " + RESET + "" + GOLD + "Set data\n";
menu += YELLOW + "" + BOLD + "4. " + RESET + "" + GOLD + "Add/clear enchantments\n";
menu += YELLOW + "" + BOLD + "5. " + RESET + "" + ITALIC + GOLD + "Set name\n";
menu += YELLOW + "" + BOLD + "6. " + RESET + "" + ITALIC + GOLD + "Set lore\n";
menu += YELLOW + "" + BOLD + "7. " + RESET + "" + GREEN + "Done\n";
menu += YELLOW + "" + BOLD + "8. " + RESET + "" + RED + "Cancel\n";
menu += GOLD + "" + BOLD + "0. " + RESET + "" + YELLOW + Lang.get("itemCreateLoadHand") + "\n";
menu += YELLOW + "" + BOLD + "1. " + RESET + "" + GOLD + Lang.get("itemCreateSetID") + "\n";
menu += YELLOW + "" + BOLD + "2. " + RESET + "" + GOLD + Lang.get("itemCreateSetAmount") + "\n";
menu += YELLOW + "" + BOLD + "3. " + RESET + "" + GOLD + Lang.get("itemCreateSetData") + "\n";
menu += YELLOW + "" + BOLD + "4. " + RESET + "" + GOLD + Lang.get("itemCreateSetEnchs") + "\n";
menu += YELLOW + "" + BOLD + "5. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetName") + "\n";
menu += YELLOW + "" + BOLD + "6. " + RESET + "" + ITALIC + GOLD + Lang.get("itemCreateSetLore") + "\n";
menu += YELLOW + "" + BOLD + "7. " + RESET + "" + GREEN + Lang.get("cancel") + "\n";
menu += YELLOW + "" + BOLD + "8. " + RESET + "" + RED + Lang.get("done") + "\n";
return menu;
}
@ -73,7 +72,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
ItemStack is = player.getItemInHand();
if(is == null || is.getType().equals(Material.AIR)){
player.sendMessage(RED + "No item in hand!");
player.sendMessage(RED + Lang.get("itemCreateNoItem"));
return new ItemStackPrompt(oldPrompt);
}else{
@ -103,7 +102,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}
player.sendMessage(GREEN + "Item loaded.");
player.sendMessage(GREEN + Lang.get("itemCreateLoaded"));
return new ItemStackPrompt(oldPrompt);
}
@ -115,7 +114,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
if(cc.getSessionData("tempId") != null){
return new AmountPrompt();
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoID"));
return new ItemStackPrompt(oldPrompt);
}
@ -124,7 +123,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
return new DataPrompt();
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID and amount first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
return new ItemStackPrompt(oldPrompt);
}
@ -133,7 +132,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
return new EnchantmentPrompt();
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID and amount first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
return new ItemStackPrompt(oldPrompt);
}
@ -142,7 +141,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
return new NamePrompt();
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID and amount first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
return new ItemStackPrompt(oldPrompt);
}
@ -151,7 +150,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
if(cc.getSessionData("tempId") != null && cc.getSessionData("tempAmount") != null){
return new LorePrompt();
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID and amount first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
return new ItemStackPrompt(oldPrompt);
}
@ -196,7 +195,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}else{
cc.getForWhom().sendRawMessage(RED + "You must set an ID and amount first!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNoIDAmount"));
return new ItemStackPrompt(oldPrompt);
}
@ -213,7 +212,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
try{
return oldPrompt;
}catch (Exception e){
cc.getForWhom().sendRawMessage(RED + "A critical error has occurred.");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateCriticalError"));
return Prompt.END_OF_CONVERSATION;
}
}
@ -223,12 +222,12 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return YELLOW + "Enter an item ID, or \"cancel\" to return.";
return YELLOW + Lang.get("itemCreateEnterID");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("cancel") == false){
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
String dataString = null;
if (input.contains(":")) {
@ -241,7 +240,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
Material mat = ItemData.getMaterial(input);
if(mat == null){
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidID"));
return new IDPrompt();
} else {
@ -249,13 +248,13 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
cc.setSessionData("tempAmount", 1);
if (dataString != null) {
try {
short data = Short.parseShort(dataString);
cc.setSessionData("tempData", data);
} catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(RED + "Invalid item data!");
return new IDPrompt();
}
try {
short data = Short.parseShort(dataString);
cc.setSessionData("tempData", data);
} catch (NumberFormatException e) {
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData"));
return new IDPrompt();
}
}
return new ItemStackPrompt(oldPrompt);
}
@ -275,18 +274,18 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return YELLOW + "Enter item amount (max. 64), or \"cancel\" to return.";
return YELLOW + Lang.get("itemCreateEnterAmount");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("cancel") == false){
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
try{
int amt = Integer.parseInt(input);
if(amt < 1 || amt > 64){
cc.getForWhom().sendRawMessage(RED + "Amount must be between 1-64!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidAmount"));
return new AmountPrompt();
}else{
cc.setSessionData("tempAmount", Integer.parseInt(input));
@ -294,7 +293,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}
}catch(NumberFormatException e){
cc.getForWhom().sendRawMessage(RED + "Invalid input!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidInput"));
return new AmountPrompt();
}
@ -311,18 +310,18 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return YELLOW + "Enter item data, or \"clear\" to clear the data, or \"cancel\" to return.";
return YELLOW + Lang.get("itemCreateEnterData");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
try{
int amt = Integer.parseInt(input);
if(amt < 1){
cc.getForWhom().sendRawMessage(RED + "Amount must be greater than 0! (default data is 0)");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidData"));
return new DataPrompt();
}else{
cc.setSessionData("tempData", Short.parseShort(input));
@ -330,11 +329,11 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}
}catch(NumberFormatException e){
cc.getForWhom().sendRawMessage(RED + "Invalid input!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidInput"));
return new DataPrompt();
}
}else if(input.equalsIgnoreCase("clear")){
}else if(input.equalsIgnoreCase(Lang.get("cmdClear"))){
cc.setSessionData("tempData", null);
@ -351,7 +350,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
String text = PINK + "- " + PURPLE + "Enchantments" + PINK + " -\n";
String text = PINK + Lang.get("enchantmentsTitle") + "\n";
for (Enchantment e : Enchantment.values()) {
text += GREEN + Quester.prettyEnchantmentString(e) + ", ";
@ -360,16 +359,16 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
text = text.substring(0, text.length() - 1);
return text + "\n" + YELLOW + "Enter an enchantment name, or \"clear\" to clear the enchantments, or \"cancel\" to return.";
return text + "\n" + YELLOW + Lang.get("itemCreateEnterEnch");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false){
if(input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false){
Enchantment e = Quests.getEnchantmentPretty(input);
Enchantment e = Quests.getEnchantment(input);
if(e != null){
cc.setSessionData("tempEnchant", e);
@ -377,12 +376,12 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}else{
cc.getForWhom().sendRawMessage(RED + "Invalid enchantment name!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidEnch"));
return new EnchantmentPrompt();
}
}else if(input.equalsIgnoreCase("clear"))
}else if(input.equalsIgnoreCase(Lang.get("cmdClear")))
cc.setSessionData("tempEnchantments", null);
return new ItemStackPrompt(oldPrompt);
@ -398,7 +397,9 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return AQUA + "Enter a level (number) for " + enchantment;
String text = Lang.get("itemCreateEnterLevel");
text = text.replaceAll("<enchantment>", enchantment);
return AQUA + text;
}
@Override
@ -408,7 +409,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
int num = Integer.parseInt(input);
if(num < 1){
cc.getForWhom().sendRawMessage(RED + "Level must be greater than 0!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateInvalidLevel"));
return new LevelPrompt(enchantment);
}else{
@ -429,7 +430,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}
}catch (NumberFormatException e){
cc.getForWhom().sendRawMessage(RED + "Input was not a number!");
cc.getForWhom().sendRawMessage(RED + Lang.get("itemCreateNotNumber"));
e.printStackTrace();
return new LevelPrompt(enchantment);
}
@ -446,18 +447,18 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return YELLOW + "Enter item name, or \"clear\" to clear the custom name, or \"cancel\" to return.";
return YELLOW + Lang.get("itemCreateEnterName");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
input = Quests.parseString(input);
cc.setSessionData("tempName", input);
}else if(input.equalsIgnoreCase("clear")){
}else if(input.equalsIgnoreCase(Lang.get("cmdClear"))){
cc.setSessionData("tempName", null);
@ -473,12 +474,12 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
@Override
public String getPromptText(ConversationContext cc) {
return YELLOW + "Enter item lore, separating each line by a semi-colon ; or \"clear\" to clear the lore, or \"cancel\" to return.";
return YELLOW + Lang.get("itemCreateEnterLore");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if(input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false){
if(input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false){
input = Quests.parseString(input);

View File

@ -6,6 +6,7 @@ import me.blackvein.quests.util.ColorUtil;
import me.blackvein.quests.Quest;
import me.blackvein.quests.Quester;
import me.blackvein.quests.Quests;
import me.blackvein.quests.util.Lang;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.conversations.Conversable;
@ -32,20 +33,22 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
quester = plugin.getQuester(((Player) cc.getForWhom()).getName());
String npc = (String) cc.getSessionData("npc");
String menu = YELLOW + "- " + GOLD + "Quests" + " | " + npc + YELLOW + " -\n";
String text = Lang.get("questNPCListTitle");
text = text.replaceAll("<npc>", npc);
String menu = text + "\n";
for (int i = 1; i <= quests.size(); i++) {
Quest quest = quests.get(i - 1);
if (quester.completedQuests.contains(quest.getName())) {
menu += DARKGREEN + "" + BOLD + "" + i + ". " + RESET + "" + GREEN + "" + ITALIC + quest.getName() + RESET + "" + GREEN + " (Completed)\n";
menu += DARKGREEN + "" + BOLD + "" + i + ". " + RESET + "" + GREEN + "" + ITALIC + quest.getName() + RESET + "" + GREEN + " (" + Lang.get("completed") + ")\n";
} else {
menu += GOLD + "" + BOLD + "" + i + ". " + RESET + "" + YELLOW + "" + ITALIC + quest.getName() + "\n";
}
}
menu += GOLD + "" + BOLD + "" + (quests.size() + 1) + ". " + RESET + "" + ColorUtil.GRAY + "Cancel\n";
menu += WHITE + "Enter an option";
menu += GOLD + "" + BOLD + "" + (quests.size() + 1) + ". " + RESET + "" + ColorUtil.GRAY + Lang.get("cancel") + "\n";
menu += WHITE + Lang.get("enterAnOption");
return menu;
}
@ -60,8 +63,8 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
//Continue
}
if (input.equalsIgnoreCase("Cancel") || numInput == (quests.size() + 1)) {
cc.getForWhom().sendRawMessage(YELLOW + "Cancelled.");
if (input.equalsIgnoreCase(Lang.get("cancel")) || numInput == (quests.size() + 1)) {
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("cancelled"));
return Prompt.END_OF_CONVERSATION;
} else {
@ -97,7 +100,7 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
}
if (q == null) {
cc.getForWhom().sendRawMessage(RED + "Invalid Selection!");
cc.getForWhom().sendRawMessage(RED + Lang.get("invalidSelection"));
return new QuestAcceptPrompt(plugin);
} else {
@ -125,7 +128,7 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
player.sendMessage(ChatColor.YELLOW + Lang.get("questOneActive"));
}
@ -134,9 +137,14 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
if (quester.currentQuest == null) {
if (quester.getDifference(q) > 0) {
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
String early = Lang.get("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) {
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
String completed = Lang.get("questAlreadyCompleted");
completed = completed.replaceAll("<quest>", ChatColor.AQUA + q.name + ChatColor.YELLOW);
player.sendMessage(ChatColor.YELLOW + completed);
} else {
quester.questToTake = q.name;
String s = extracted(quester);
@ -150,7 +158,7 @@ public class QuestAcceptPrompt extends StringPrompt implements ColorUtil {
} else if (quester.currentQuest.equals(q) == false) {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
player.sendMessage(ChatColor.YELLOW + Lang.get("questOneActive"));
}

View File

@ -1,5 +1,6 @@
package me.blackvein.quests.prompts;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.herocraftonline.heroes.characters.classes.HeroClass;
import java.util.Arrays;
import java.util.Collections;
@ -43,27 +44,29 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
String text;
text = DARKAQUA + "- " + AQUA + context.getSessionData(CK.Q_NAME) + AQUA + " | Requirements -\n";
String lang = Lang.get("requirementsTitle");
lang = lang.replaceAll("<quest>", AQUA + (String) context.getSessionData(CK.Q_NAME) + DARKAQUA);
text = DARKAQUA + lang + "\n";
if (context.getSessionData(CK.REQ_MONEY) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetMoney") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
int moneyReq = (Integer) context.getSessionData(CK.REQ_MONEY);
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money requirement (" + moneyReq + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetMoney") + " (" + moneyReq + " " + (moneyReq > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
}
if (context.getSessionData(CK.REQ_QUEST_POINTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points requirement " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points requirement " + GRAY + "(" + AQUA + context.getSessionData(CK.REQ_QUEST_POINTS) + " Quest Points" + GRAY + ")\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetQuestPoints") + " " + GRAY + "(" + AQUA + context.getSessionData(CK.REQ_QUEST_POINTS) + " " + Lang.get("questPoints") + GRAY + ")\n";
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item requirements\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("reqSetItem") + "\n";
if (context.getSessionData(CK.REQ_PERMISSION) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set permission requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("reqSetPerms") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set permission requirements\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("reqSetPerms") + "\n";
List<String> perms = (List<String>) context.getSessionData(CK.REQ_PERMISSION);
for (String s : perms) {
@ -74,9 +77,9 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REQ_QUEST) == null) {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Quest requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("reqSetQuest") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set Quest requirements\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("reqSetQuest") + "\n";
List<String> qs = (List<String>) context.getSessionData(CK.REQ_QUEST);
for (String s : qs) {
@ -87,9 +90,9 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REQ_QUEST_BLOCK) == null) {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Quest blocks " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("reqSetQuestBlocks") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set Quest blocks\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("reqSetQuestBlocks") + "\n";
List<String> qs = (List<String>) context.getSessionData(CK.REQ_QUEST_BLOCK);
for (String s : qs) {
@ -102,45 +105,45 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (Quests.mcmmo != null) {
if (context.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("reqSetMcMMO") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO requirements\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("reqSetMcMMO") + "\n";
List<String> skills = (List<String>) context.getSessionData(CK.REQ_MCMMO_SKILLS);
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
for (String s : skills) {
text += GRAY + " - " + DARKGREEN + s + RESET + YELLOW + " level " + GREEN + amounts.get(skills.indexOf(s)) + "\n";
text += GRAY + " - " + DARKGREEN + s + RESET + YELLOW + " " + Lang.get("mcMMOLevel") + " " + GREEN + amounts.get(skills.indexOf(s)) + "\n";
}
}
} else {
text += GRAY + "6 - Set mcMMO requirements (mcMMO not installed)\n";
text += GRAY + "6 - " + Lang.get("reqSetMcMMO") + " (" + Lang.get("reqNoMcMMO") + ")\n";
}
if (Quests.heroes != null) {
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes requirements " + GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("reqSetHeroes") + " " + GRAY + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes requirements\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("reqSetHeroes") + "\n";
if (context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null) {
text += AQUA + " Primary Class: " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + "\n";
text += AQUA + " " + Lang.get("reqHeroesPrimaryDisplay") + " " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + "\n";
}
if (context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null) {
text += AQUA + " Secondary Class: " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + "\n";
text += AQUA + " " + Lang.get("reqHeroesSecondaryDisplay") + " " + BLUE + (String) context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + "\n";
}
}
} else {
text += GRAY + "8 - Set Heroes requirements (Heroes not installed)\n";
text += GRAY + "8 - " + Lang.get("reqSetHeroes") + " (" + Lang.get("reqNoHeroes") + ")\n";
}
if (context.getSessionData(CK.REQ_CUSTOM) == null) {
text += BLUE + "" + BOLD + "9 - " + RESET + ITALIC + PURPLE + "Custom Requirements (None set)\n";
text += BLUE + "" + BOLD + "9 - " + RESET + ITALIC + PURPLE + Lang.get("reqSetCustom") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "9 - " + RESET + ITALIC + PURPLE + "Custom Requirements\n";
text += BLUE + "" + BOLD + "9 - " + RESET + ITALIC + PURPLE + Lang.get("reqSetCustom") + "\n";
LinkedList<String> customReqs = (LinkedList<String>) context.getSessionData(CK.REQ_CUSTOM);
for(String s : customReqs){
@ -150,14 +153,14 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REQ_MONEY) == null && context.getSessionData(CK.REQ_QUEST_POINTS) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_ITEMS) == null && context.getSessionData(CK.REQ_PERMISSION) == null && context.getSessionData(CK.REQ_QUEST) == null && context.getSessionData(CK.REQ_QUEST_BLOCK) == null && context.getSessionData(CK.REQ_MCMMO_SKILLS) == null && context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null && context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null && context.getSessionData(CK.REQ_CUSTOM) == null) {
text += GRAY + "" + BOLD + "10 - " + RESET + GRAY + "Set fail requirements message (No requirements set)\n";
text += GRAY + "" + BOLD + "10 - " + RESET + GRAY + Lang.get("reqSetFail") + " (" + Lang.get("reqNone") + ")\n";
} else if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
text += RED + "" + BOLD + "10 - " + RESET + RED + "Set fail requirements message (Required)\n";
text += RED + "" + BOLD + "10 - " + RESET + RED + Lang.get("reqSetFail") + " (" + Lang.get("questRequiredNoneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "10 - " + RESET + YELLOW + "Set fail requirements message" + GRAY + "(" + AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE) + "\"" + GRAY + ")\n";
text += BLUE + "" + BOLD + "10 - " + RESET + YELLOW + Lang.get("reqSetFail") + GRAY + "(" + AQUA + "\"" + context.getSessionData(CK.Q_FAIL_MESSAGE) + "\"" + GRAY + ")\n";
}
text += GREEN + "" + BOLD + "11" + RESET + YELLOW + " - Done";
text += GREEN + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("done");
return text;
@ -198,7 +201,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (context.getSessionData(CK.REQ_MONEY) != null || context.getSessionData(CK.REQ_QUEST_POINTS) != null || context.getSessionData(CK.REQ_ITEMS) != null || context.getSessionData(CK.REQ_PERMISSION) != null || context.getSessionData(CK.REQ_QUEST) != null || context.getSessionData(CK.REQ_QUEST_BLOCK) != null || context.getSessionData(CK.REQ_MCMMO_SKILLS) != null || context.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) != null || context.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) != null || context.getSessionData(CK.REQ_CUSTOM) != null) {
if (context.getSessionData(CK.Q_FAIL_MESSAGE) == null) {
context.getForWhom().sendRawMessage(RED + "You must set a fail requirements message!");
context.getForWhom().sendRawMessage(RED + Lang.get("reqNoMessage"));
return new RequirementsPrompt(quests, factory);
}
@ -215,7 +218,9 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of " + PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? "Money" : Quests.economy.currencyNamePlural())) + YELLOW + ", or 0 to clear the money requirement, or -1 to cancel";
String text = Lang.get("reqMoneyPrompt");
text = text.replaceAll("<money>", PURPLE + ((Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural())) + YELLOW);
return YELLOW + text;
}
@ -223,7 +228,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be greater than 0!");
context.getForWhom().sendRawMessage(RED + Lang.get("reqGreaterThanZero"));
return new MoneyPrompt();
} else if (input.intValue() == -1) {
return new RequirementsPrompt(quests, factory);
@ -243,7 +248,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of Quest Points, or 0 to clear the Quest Point requirement,\nor -1 to cancel";
return YELLOW + Lang.get("reqQuestPointsPrompt");
}
@ -251,7 +256,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be greater than 0!");
context.getForWhom().sendRawMessage(RED + Lang.get("reqGreaterThanZero"));
return new QuestPointsPrompt();
} else if (input.intValue() == -1) {
return new RequirementsPrompt(quests, factory);
@ -270,9 +275,6 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
private final boolean isRequiredQuest;
/*public QuestListPrompt() {
this.isRequiredQuest = true;
}*/
public QuestListPrompt(boolean isRequired) {
this.isRequiredQuest = isRequired;
}
@ -280,7 +282,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = PINK + "- Quests -\n" + PURPLE;
String text = PINK + Lang.get("questListTitle") + "\n" + PURPLE;
boolean none = true;
for (Quest q : quests.getQuests()) {
@ -291,13 +293,15 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (none) {
text += "(None)\n";
text += "(" + Lang.get("none") + ")\n";
} else {
text = text.substring(0, (text.length() - 2));
text += "\n";
}
text += YELLOW + "Enter a list of Quest names separating each one by a " + RED + BOLD + "comma" + RESET + YELLOW + ", or enter \'clear\' to clear the list, or \'cancel\' to return.";
String lang = Lang.get("reqQuestPrompt");
lang = lang.replaceAll("<comma>", RED + "" + BOLD + Lang.get("comma") + RESET + YELLOW);
text += YELLOW + lang;
return text;
@ -306,7 +310,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(",");
LinkedList<String> questNames = new LinkedList<String>();
@ -315,14 +319,16 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (quests.getQuest(s) == null) {
context.getForWhom().sendRawMessage(PINK + s + " " + RED + "is not a Quest name!");
String text = Lang.get("reqNotAQuestName");
text = text.replaceAll("<quest>", PINK + s + RED);
context.getForWhom().sendRawMessage(text);
return new QuestListPrompt(isRequiredQuest);
}
if (questNames.contains(s)) {
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
context.getForWhom().sendRawMessage(RED + Lang.get("listDuplicate"));
return new QuestListPrompt(isRequiredQuest);
}
@ -346,7 +352,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REQ_QUEST_BLOCK, questNames);
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
if (isRequiredQuest) {
context.setSessionData(CK.REQ_QUEST, null);
@ -389,12 +395,12 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
String text = GOLD + "- Item Requirements -\n";
String text = GOLD + Lang.get("itemRequirementsTitle") + "\n";
if (context.getSessionData(CK.REQ_ITEMS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += GRAY + "2 - Set remove items (No items set)\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
text += GRAY + "2 - " + Lang.get("reqSetRemoveItems") + "(" + Lang.get("reqNoItemsSet") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
} else {
for (ItemStack is : getItems(context)) {
@ -403,23 +409,23 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
if (context.getSessionData(CK.REQ_ITEMS_REMOVE) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set remove items (No values set)\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetRemoveItems") + "(" + Lang.get("reqNoValuesSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set remove items\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetRemoveItems") + "\n";
for (Boolean b : getRemoveItems(context)) {
text += GRAY + " - " + AQUA + b.toString().toLowerCase() + "\n";
text += GRAY + " - " + AQUA + (b.equals(Boolean.TRUE) ? Lang.get("yesWord") : Lang.get("noWord")) + "\n";
}
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
}
@ -434,13 +440,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
return new ItemStackPrompt(ItemListPrompt.this);
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(CK.REQ_ITEMS) == null) {
context.getForWhom().sendRawMessage(RED + "You must add at least one item first!");
context.getForWhom().sendRawMessage(RED + Lang.get("reqMustAddItem"));
return new ItemListPrompt();
} else {
return new RemoveItemsPrompt();
}
} else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "Item requirements cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqItemCleared"));
context.setSessionData(CK.REQ_ITEMS, null);
context.setSessionData(CK.REQ_ITEMS_REMOVE, null);
return new ItemListPrompt();
@ -464,7 +470,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (one == two) {
return new RequirementsPrompt(quests, factory);
} else {
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "items list " + RED + "and " + GOLD + "remove items list " + RED + "are not the same size!");
context.getForWhom().sendRawMessage(RED + Lang.get("reqListsNotSameSize"));
return new ItemListPrompt();
}
}
@ -485,25 +491,27 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter a list of true/false values, separating each one by a space, or enter \'cancel\' to return.";
return YELLOW + Lang.get("reqRemoveItemsPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Boolean> booleans = new LinkedList<Boolean>();
for (String s : args) {
if (s.equalsIgnoreCase("true") || s.equalsIgnoreCase("yes")) {
if (s.equalsIgnoreCase(Lang.get("true")) || s.equalsIgnoreCase(Lang.get("yesWord"))) {
booleans.add(true);
} else if (s.equalsIgnoreCase("false") || s.equalsIgnoreCase("no")) {
} else if (s.equalsIgnoreCase(Lang.get("false")) || s.equalsIgnoreCase(Lang.get("noWord"))) {
booleans.add(false);
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a true or false value!\n " + GOLD + "Example: true false true true");
String text = Lang.get("reqTrueFalseError");
text = text.replaceAll("<input>", PINK + s + RED);
context.getForWhom().sendRawMessage(RED + text);
return new RemoveItemsPrompt();
}
@ -522,13 +530,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter permission requirements separating each one by a space, or enter \'clear\' to clear the list, or enter \'cancel\' to return.";
return YELLOW + Lang.get("reqPermissionsPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(" ");
LinkedList<String> permissions = new LinkedList<String>();
@ -536,7 +544,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REQ_PERMISSION, permissions);
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REQ_PERMISSION, null);
}
@ -549,21 +557,21 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = PINK + "- Custom Requirements -\n";
String text = PINK + Lang.get("customRequirementsTitle") + "\n";
if(quests.customRequirements.isEmpty()){
text += BOLD + "" + PURPLE + "(No modules loaded)";
text += BOLD + "" + PURPLE + "(" + Lang.get("stageEditorNoModules") + ")";
}else {
for(CustomRequirement cr : quests.customRequirements)
text += PURPLE + " - " + cr.getName() + "\n";
}
return text + YELLOW + "Enter the name of a custom requirement to add, or enter \'clear\' to clear all custom requirements, or \'cancel\' to return.";
return text + YELLOW + Lang.get("reqCustomPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomRequirement found = null;
for(CustomRequirement cr : quests.customRequirements){
@ -593,7 +601,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REQ_CUSTOM, list);
context.setSessionData(CK.REQ_CUSTOM_DATA, datamapList);
}else{
context.getForWhom().sendRawMessage(YELLOW + "That custom requirement has already been added!");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqCustomAlreadyAdded"));
return new CustomRequirementsPrompt();
}
}else{
@ -615,15 +623,15 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
//
}else{
context.getForWhom().sendRawMessage(YELLOW + "Custom requirement module not found.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqCustomNotFound"));
return new CustomRequirementsPrompt();
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REQ_CUSTOM, null);
context.setSessionData(CK.REQ_CUSTOM_DATA, null);
context.setSessionData(CK.REQ_CUSTOM_DATA_TEMP, null);
context.getForWhom().sendRawMessage(YELLOW + "Custom requirements cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("reqCustomCleared"));
}
return new RequirementsPrompt(quests, factory);
@ -658,13 +666,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if(datamap.get(dataKey) != null)
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
else
text += RED + " (Value required)\n";
text += RED + " (" + Lang.get("valRequired") + ")\n";
index++;
}
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + "Finish";
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + Lang.get("finish");
return text;
}
@ -722,8 +730,9 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if(descriptions.get(temp) != null)
text += GOLD + descriptions.get(temp) + "\n";
text += YELLOW + "Enter value for ";
text += BOLD + temp + RESET + YELLOW + ":";
String lang = Lang.get("stageEditorCustomDataPrompt");
lang = lang.replaceAll("<data>", temp);
text += YELLOW + lang;
return text;
}
@ -747,11 +756,11 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = DARKGREEN + "- mcMMO Requirements -\n";
String text = DARKGREEN + Lang.get("mcMMORequirementsTitle") + "\n";
if (cc.getSessionData(CK.REQ_MCMMO_SKILLS) == null) {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set skills (None set)\n";
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - " + Lang.get("reqSetSkills") + "(" + Lang.get("noneSet") + ")\n";
} else {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set skills\n";
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - " + Lang.get("reqSetSkills") + "\n";
LinkedList<String> skills = (LinkedList<String>) cc.getSessionData(CK.REQ_MCMMO_SKILLS);
for (String skill : skills) {
text += GRAY + " - " + AQUA + skill + "\n";
@ -759,16 +768,16 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS) == null) {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set skill amounts (None set)\n";
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set skill amounts\n";
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - " + Lang.get("reqSetSkillAmounts") + "\n";
LinkedList<Integer> amounts = (LinkedList<Integer>) cc.getSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS);
for (int i : amounts) {
text += GRAY + " - " + AQUA + i + "\n";
}
}
text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - Done";
text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - " + Lang.get("done");
return text;
}
@ -793,32 +802,25 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String skillList = DARKGREEN + Lang.get("skillListTitle") + "\n";
SkillType[] skills = SkillType.values();
for(int i = 0; i < skills.length; i++) {
if(i == (skills.length - 1))
skillList += GREEN + skills[i].getName() + "\n";
else
skillList += GREEN + skills[i].getName() + "\n\n";
}
String skillList
= DARKGREEN + "-Skill List-\n"
+ GREEN + "Acrobatics\n"
+ GREEN + "All\n"
+ GREEN + "Archery\n"
+ GREEN + "Axes\n"
+ GREEN + "Excavation\n"
+ GREEN + "Fishing\n"
+ GREEN + "Herbalism\n"
+ GREEN + "Mining\n"
+ GREEN + "Repair\n"
+ GREEN + "Smelting\n"
+ GREEN + "Swords\n"
+ GREEN + "Taming\n"
+ GREEN + "Unarmed\n"
+ GREEN + "Woodcutting\n\n";
return skillList + YELLOW + "Enter mcMMO skills, separating each one by a space, or enter \'clear\' to clear the list, "
+ "or \'cancel\' to return.\n";
return skillList + YELLOW + Lang.get("reqMcMMOPrompt");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
LinkedList<String> skills = new LinkedList<String>();
@ -829,10 +831,12 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
if (Quests.getMcMMOSkill(formatted) != null) {
skills.add(formatted);
} else if (skills.contains(formatted)) {
cc.getForWhom().sendRawMessage(YELLOW + "Error: List contains duplicates!");
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("listDuplicate"));
return new mcMMOSkillsPrompt();
} else {
cc.getForWhom().sendRawMessage(YELLOW + "Error: " + RED + s + YELLOW + " is not an mcMMO skill name!");
String text = Lang.get("reqMcMMOError");
text = text.replaceAll("<input>", RED + s + YELLOW);
cc.getForWhom().sendRawMessage(YELLOW + text);
return new mcMMOSkillsPrompt();
}
@ -841,11 +845,11 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
cc.setSessionData(CK.REQ_MCMMO_SKILLS, skills);
return new mcMMOPrompt();
} else if (input.equalsIgnoreCase("clear")) {
cc.getForWhom().sendRawMessage(YELLOW + "mcMMO skill requirements cleared.");
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("reqMcMMOCleared"));
cc.setSessionData(CK.REQ_MCMMO_SKILLS, null);
return new mcMMOPrompt();
} else if (input.equalsIgnoreCase("cancel")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new mcMMOPrompt();
}
@ -860,14 +864,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter mcMMO skill amounts, separating each one by a space, or enter \'clear\' to clear the list, "
+ "or \'cancel\' to return.\n";
return YELLOW + Lang.get("reqMcMMOAmountsPrompt");
}
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
LinkedList<Integer> amounts = new LinkedList<Integer>();
@ -879,7 +882,9 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
amounts.add(i);
} catch (NumberFormatException nfe) {
cc.getForWhom().sendRawMessage(YELLOW + "Error: " + RED + s + YELLOW + " is not a number!");
String text = Lang.get("reqNotANumber");
text = text.replaceAll("<input>", RED + s + YELLOW);
cc.getForWhom().sendRawMessage(YELLOW + text);
return new mcMMOAmountsPrompt();
}
@ -888,11 +893,11 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, amounts);
return new mcMMOPrompt();
} else if (input.equalsIgnoreCase("clear")) {
cc.getForWhom().sendRawMessage(YELLOW + "mcMMO skill amount requirements cleared.");
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("reqMcMMOAmountsCleared"));
cc.setSessionData(CK.REQ_MCMMO_SKILL_AMOUNTS, null);
return new mcMMOPrompt();
} else if (input.equalsIgnoreCase("cancel")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdCancel"))) {
return new mcMMOPrompt();
}
@ -911,20 +916,20 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = DARKGREEN + "- Heroes Requirements -\n";
String text = DARKGREEN + Lang.get("heroesRequirementsTitle") + "\n";
if (cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) == null) {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set Primary Class (None set)\n";
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - " + Lang.get("reqHeroesSetPrimary") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - Set Primary Class (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + GREEN + ")\n";
text += BOLD + "" + GREEN + "1" + RESET + GREEN + " - " + Lang.get("reqHeroesSetPrimary") + " (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_PRIMARY_CLASS) + GREEN + ")\n";
}
if (cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) == null) {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set Secondary Class (None set)\n";
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - " + Lang.get("reqHeroesSetSecondary") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - Set Secondary Class (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + GREEN + ")\n";
text += BOLD + "" + GREEN + "2" + RESET + GREEN + " - " + Lang.get("reqHeroesSetSecondary") + " (" + AQUA + (String) cc.getSessionData(CK.REQ_HEROES_SECONDARY_CLASS) + GREEN + ")\n";
}
text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - Done";
text += BOLD + "" + GREEN + "3" + RESET + GREEN + " - " + Lang.get("done");
return text;
}
@ -950,7 +955,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = PURPLE + "- " + PINK + "Primary Classes" + PURPLE + " -\n";
String text = PURPLE + Lang.get("heroesPrimaryTitle") + "\n";
LinkedList<String> list = new LinkedList<String>();
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
if (hc.isPrimary()) {
@ -959,7 +964,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (list.isEmpty()) {
text += GRAY + "(None)\n";
text += GRAY + "(" + Lang.get("none") + ")\n";
} else {
Collections.sort(list);
@ -970,7 +975,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += YELLOW + "Enter a Heroes Primary Class name, or enter \"clear\" to clear the requirement, or \"cancel\" to return.";
text += YELLOW + Lang.get("reqHeroesPrimaryPrompt");
return text;
}
@ -978,7 +983,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
HeroClass hc = Quests.heroes.getClassManager().getClass(input);
if (hc != null) {
@ -989,19 +994,21 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
return new HeroesPrompt();
} else {
cc.getForWhom().sendRawMessage(RED + "The " + PINK + hc.getName() + RED + " class is not primary!");
String text = Lang.get("reqHeroesNotPrimary");
text = text.replaceAll("<class>", PINK + hc.getName() + RED);
cc.getForWhom().sendRawMessage(RED + text);
return new HeroesPrimaryPrompt();
}
} else {
cc.getForWhom().sendRawMessage(RED + "Class not found!");
cc.getForWhom().sendRawMessage(RED + Lang.get("reqHeroesClassNotFound"));
return new HeroesPrimaryPrompt();
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
cc.setSessionData(CK.REQ_HEROES_PRIMARY_CLASS, null);
cc.getForWhom().sendRawMessage(YELLOW + "Heroes Primary Class requirement cleared.");
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("reqHeroesPrimaryCleared"));
return new HeroesPrompt();
} else {
@ -1018,7 +1025,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = PURPLE + "- " + PINK + "Secondary Classes" + PURPLE + " -\n";
String text = PURPLE + Lang.get("heroesSecondaryTitle") + "\n";
LinkedList<String> list = new LinkedList<String>();
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
if (hc.isSecondary()) {
@ -1027,7 +1034,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (list.isEmpty()) {
text += GRAY + "(None)\n";
text += GRAY + "(" + Lang.get("none") + ")\n";
} else {
Collections.sort(list);
@ -1038,7 +1045,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += YELLOW + "Enter a Heroes Secondary Class name, or enter \"clear\" to clear the requirement, or \"cancel\" to return.";
text += YELLOW + Lang.get("reqHeroesSecondaryPrompt");
return text;
}
@ -1046,7 +1053,7 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("clear") == false && input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdClear")) == false && input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
HeroClass hc = Quests.heroes.getClassManager().getClass(input);
if (hc != null) {
@ -1057,19 +1064,22 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
return new HeroesPrompt();
} else {
cc.getForWhom().sendRawMessage(RED + "The " + PINK + hc.getName() + RED + " class is not secondary!");
String text = Lang.get("reqHeroesNotSecondary");
text = text.replaceAll("<class>", PINK + hc.getName() + RED);
cc.getForWhom().sendRawMessage(RED + text);
return new HeroesSecondaryPrompt();
}
} else {
cc.getForWhom().sendRawMessage(RED + "Class not found!");
cc.getForWhom().sendRawMessage(RED + Lang.get("reqHeroesClassNotFound"));
return new HeroesSecondaryPrompt();
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("clear"))) {
cc.setSessionData(CK.REQ_HEROES_SECONDARY_CLASS, null);
cc.getForWhom().sendRawMessage(YELLOW + "Heroes Secondary Class requirement cleared.");
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("reqHeroesSecondaryCleared"));
return new HeroesPrompt();
} else {
@ -1085,13 +1095,13 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter fail requirements message, or enter \'cancel\' to return.";
return YELLOW + Lang.get("reqFailMessagePrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get(Lang.get("cancel"))) == false) {
context.setSessionData(CK.Q_FAIL_MESSAGE, input);
}

View File

@ -2,6 +2,7 @@ package me.blackvein.quests.prompts;
import com.codisimus.plugins.phatloots.PhatLoot;
import com.codisimus.plugins.phatloots.PhatLootsAPI;
import com.gmail.nossr50.datatypes.skills.SkillType;
import com.herocraftonline.heroes.characters.classes.HeroClass;
import java.util.Arrays;
import java.util.Collections;
@ -42,33 +43,35 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
String text;
text = DARKAQUA + "- " + AQUA + context.getSessionData(CK.Q_NAME) + AQUA + " | Rewards -\n";
String lang = Lang.get("rewardsTitle");
lang = lang.replaceAll("<quest>", AQUA + (String) context.getSessionData(CK.Q_NAME) + DARKAQUA);
text = DARKAQUA + lang + "\n";
if (context.getSessionData(CK.REW_MONEY) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (None set)\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("rewSetMoney") + " (" + Lang.get("noneSet") + ")\n";
} else {
int moneyRew = (Integer) context.getSessionData(CK.REW_MONEY);
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set money reward (" + moneyRew + " " + (moneyRew > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("rewSetMoney") + " (" + moneyRew + " " + (moneyRew > 1 ? Quests.getCurrency(true) : Quests.getCurrency(false)) + ")\n";
}
if (context.getSessionData(CK.REW_QUEST_POINTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (None set)\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("rewSetQuestPoints") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set Quest Points reward (" + context.getSessionData(CK.REW_QUEST_POINTS) + " Quest Points)\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("rewSetQuestPoints") + " (" + context.getSessionData(CK.REW_QUEST_POINTS) + " " + Lang.get("questPoints") + ")\n";
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("rewSetItems") + "\n";
if (context.getSessionData(CK.REW_EXP) == null) {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (None set)\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("rewSetExperience") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("rewSetExperience") + " (" + context.getSessionData(CK.REW_EXP) + " " + Lang.get("points") + ")\n";
}
if (context.getSessionData(CK.REW_COMMAND) == null) {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards (None set)\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("rewSetCommands") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards\n";
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("rewSetCommands") + "\n";
List<String> commands = (List<String>) context.getSessionData(CK.REW_COMMAND);
for (String cmd : commands) {
@ -79,9 +82,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REW_PERMISSION) == null) {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards (None set)\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("rewSetPermission") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards\n";
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("rewSetPermission") + "\n";
List<String> permissions = (List<String>) context.getSessionData(CK.REW_PERMISSION);
for (String perm : permissions) {
@ -94,9 +97,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if (Quests.mcmmo != null) {
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("rewSetMcMMO") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("rewSetMcMMO") + "\n";
List<String> skills = (List<String>) context.getSessionData(CK.REW_MCMMO_SKILLS);
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
@ -109,38 +112,38 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
} else {
text += GRAY + "7 - Set mcMMO skill rewards (mcMMO not installed)\n";
text += GRAY + "7 - " + Lang.get("rewSetMcMMO") + " (" + Lang.get("reqNoMcMMO") + ")\n";
}
if (Quests.heroes != null) {
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes experience rewards (None set)\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("rewSetHeroes") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes experience rewards\n";
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("rewSetHeroes") + "\n";
List<String> heroClasses = (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES);
List<Double> amounts = (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS);
for (String heroClass : heroClasses) {
text += GRAY + " - " + AQUA + amounts.get(heroClasses.indexOf(heroClass)) + " " + DARKAQUA + heroClass + " Experience\n";
text += GRAY + " - " + AQUA + amounts.get(heroClasses.indexOf(heroClass)) + " " + DARKAQUA + heroClass + " " + Lang.get("experience") + "\n";
}
}
} else {
text += GRAY + "8 - Set Heroes experience rewards (Heroes not installed)\n";
text += GRAY + "8 - " + Lang.get("rewSetHeroes") + " (" + Lang.get("rewNoHeroes") + ")\n";
}
if (Quests.phatLoots != null) {
if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set PhatLoot rewards (None set)\n";
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("rewSetPhat") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set PhatLoot rewards\n";
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("rewSetPhat") + "\n";
List<String> phatLoots = (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS);
for (String phatLoot : phatLoots) {
@ -152,14 +155,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
} else {
text += GRAY + "9 - Set PhatLoot rewards (PhatLoots not installed)\n";
text += GRAY + "9 - " + Lang.get("rewSetPhat") + " (" + Lang.get("rewNoPhat") + ")\n";
}
if (context.getSessionData(CK.REW_CUSTOM) == null) {
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + "Custom Rewards (None set)\n";
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + Lang.get("rewSetCustom") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + "Custom Rewards\n";
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + Lang.get("rewSetCustom") + "\n";
LinkedList<String> customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
for(String s : customRews){
@ -168,7 +171,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
}
text += GREEN + "" + BOLD + "11" + RESET + YELLOW + " - Done";
text += GREEN + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("done");
return text;
@ -221,7 +224,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of " + AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? "Money" : Quests.economy.currencyNamePlural()) + YELLOW + ", or 0 to clear the money reward, or -1 to cancel";
String text = Lang.get("rewMoneyPrompt");
text = text.replaceAll("<money>", AQUA + (Quests.economy.currencyNamePlural().isEmpty() ? Lang.get("money") : Quests.economy.currencyNamePlural()) + YELLOW);
return YELLOW + text;
}
@ -229,7 +234,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
context.getForWhom().sendRawMessage(RED + Lang.get("inputPosNum"));
return new MoneyPrompt();
} else if (input.intValue() == 0) {
context.setSessionData(CK.REW_MONEY, null);
@ -248,7 +253,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of experience, or 0 to clear the experience reward, or -1 to cancel";
return YELLOW + Lang.get("rewExperiencePrompt");
}
@ -256,7 +261,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
context.getForWhom().sendRawMessage(RED + Lang.get("inputPosNum"));
return new ExperiencePrompt();
} else if (input.intValue() == -1) {
context.setSessionData(CK.REW_EXP, null);
@ -275,7 +280,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter amount of Quest Points, or 0 to clear the Quest Points reward, or -1 to cancel";
return YELLOW + Lang.get("rewQuestPointsPrompt");
}
@ -283,7 +288,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
if (input.intValue() < -1) {
context.getForWhom().sendRawMessage(RED + "Amount must be positive!");
context.getForWhom().sendRawMessage(RED + Lang.get("inputPosNum"));
return new QuestPointsPrompt();
} else if (input.intValue() == -1) {
context.setSessionData(CK.REW_QUEST_POINTS, null);
@ -325,12 +330,12 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
String text = GOLD + "- Item Rewards -\n";
String text = GOLD + Lang.get("itemRewardsTitle") + "\n";
if (context.getSessionData(CK.REW_ITEMS) == null) {
text += GRAY + " (" + Lang.get("noneSet") + ")\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done");
} else {
for (ItemStack is : getItems(context)) {
@ -338,9 +343,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
text += GRAY + "- " + ItemUtil.getDisplayString(is) + "\n";
}
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Add item\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqAddItem") + "\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("done");
}
@ -354,7 +359,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if (input.equalsIgnoreCase("1")) {
return new ItemStackPrompt(ItemListPrompt.this);
} else if (input.equalsIgnoreCase("2")) {
context.getForWhom().sendRawMessage(YELLOW + "Item rewards cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewItemsCleared"));
context.setSessionData(CK.REW_ITEMS, null);
return new ItemListPrompt();
} else if (input.equalsIgnoreCase("3")) {
@ -374,14 +379,16 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String note = GOLD + "\nNote: You may put <player> to specify the player who completed the Quest. e.g. " + AQUA + BOLD + ITALIC + "smite <player>" + RESET;
return YELLOW + "Enter command rewards separating each one by a " + BOLD + "comma" + RESET + YELLOW + ", or enter \'clear\' to clear the list, or enter \'cancel\' to return." + note;
String lang1 = Lang.get("rewCommandPrompt");
lang1 = lang1.replaceAll("<comma>", BOLD + "" + RED + "comma" + RESET + YELLOW);
String lang2 = Lang.get("rewCommandPromptHint");
return YELLOW + lang1 + "\n" + lang2;
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(",");
LinkedList<String> commands = new LinkedList<String>();
@ -397,7 +404,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REW_COMMAND, commands);
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_COMMAND, null);
}
@ -411,13 +418,13 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter permission rewards separating each one by a space, or enter \'clear\' to clear the list, or enter \'cancel\' to return.";
return YELLOW + Lang.get("rewPermissionsPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] args = input.split(" ");
LinkedList<String> permissions = new LinkedList<String>();
@ -425,7 +432,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REW_PERMISSION, permissions);
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_PERMISSION, null);
}
@ -447,15 +454,15 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- mcMMO Rewards -\n";
String text = GOLD + Lang.get("mcMMORewardsTitle") + "\n";
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set skills (None set)\n";
text += GRAY + "2 - Set skill amounts (No skills set)\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetSkills") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("rewNoMcMMOSkills") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
} else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set skills\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("reqSetSkills") + "\n";
for (String s : getSkills(context)) {
text += GRAY + " - " + AQUA + s + "\n";
@ -463,10 +470,10 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REW_MCMMO_AMOUNTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts (None set)\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetSkillAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set skill amounts\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("reqSetSkillAmounts") + "\n";
for (Integer i : getSkillAmounts(context)) {
text += GRAY + " - " + AQUA + i + "\n";
@ -475,8 +482,8 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
}
@ -491,13 +498,13 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
return new mcMMOSkillsPrompt();
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
context.getForWhom().sendRawMessage(RED + "You must set skills first!");
context.getForWhom().sendRawMessage(RED + Lang.get("rewSetMcMMOSkillsFirst"));
return new mcMMOListPrompt();
} else {
return new mcMMOAmountsPrompt();
}
} else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "mcMMO rewards cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewMcMMOCleared"));
context.setSessionData(CK.REW_MCMMO_SKILLS, null);
context.setSessionData(CK.REW_MCMMO_AMOUNTS, null);
return new mcMMOListPrompt();
@ -521,7 +528,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if (one == two) {
return new RewardsPrompt(quests, factory);
} else {
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "skills list " + RED + "and " + GOLD + "skill amounts list " + RED + "are not the same size!");
context.getForWhom().sendRawMessage(RED + Lang.get("rewMcMMOListsNotSameSize"));
return new mcMMOListPrompt();
}
}
@ -543,31 +550,25 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String skillList
= GOLD + "-Skill List-\n"
+ AQUA + "Acrobatics\n"
+ GRAY + "All\n"
+ AQUA + "Archery\n"
+ AQUA + "Axes\n"
+ AQUA + "Excavation\n"
+ AQUA + "Fishing\n"
+ AQUA + "Herbalism\n"
+ AQUA + "Mining\n"
+ AQUA + "Repair\n"
+ AQUA + "Smelting\n"
+ AQUA + "Swords\n"
+ AQUA + "Taming\n"
+ AQUA + "Unarmed\n"
+ AQUA + "Woodcutting\n\n";
String skillList = DARKGREEN + Lang.get("skillListTitle") + "\n";
SkillType[] skills = SkillType.values();
for(int i = 0; i < skills.length; i++) {
if(i == (skills.length - 1))
skillList += GREEN + skills[i].getName() + "\n";
else
skillList += GREEN + skills[i].getName() + "\n\n";
}
return skillList + YELLOW + "Enter mcMMO skills, separating each one by a space, or enter \'cancel\' to return."
+ "\n" + GOLD + "Note: The \'All\' option will give levels to all skills.";
return skillList + Lang.get("rewMcMMOPrompt") + "\n" + GOLD + Lang.get("rewMcMMOPromptHint");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<String> skills = new LinkedList<String>();
@ -578,12 +579,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if (skills.contains(s) == false) {
skills.add(Quester.getCapitalized(s));
} else {
context.getForWhom().sendRawMessage(RED + "List contains duplicates!");
context.getForWhom().sendRawMessage(RED + Lang.get("listDuplicate"));
return new mcMMOSkillsPrompt();
}
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not a valid mcMMO skill!");
String text = Lang.get("reqMcMMOError");
text = text.replaceAll("<input>", PINK + s + RED);
context.getForWhom().sendRawMessage(RED + text);
return new mcMMOSkillsPrompt();
}
@ -603,29 +606,26 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
return YELLOW + "Enter skill amounts (numbers), separating each one by a space, or enter \'cancel\' to return.";
return YELLOW + Lang.get("reqMcMMOAmountsPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] args = input.split(" ");
LinkedList<Integer> amounts = new LinkedList<Integer>();
for (String s : args) {
try {
if (Integer.parseInt(s) > 0) {
amounts.add(Integer.parseInt(s));
} else {
context.getForWhom().sendRawMessage(PINK + s + RED + " is not greater than 0!");
return new mcMMOAmountsPrompt();
}
amounts.add(Integer.parseInt(s));
} catch (NumberFormatException e) {
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
String text = Lang.get("reqNotANumber");
text = text.replaceAll("<input>", PINK + s + RED);
context.getForWhom().sendRawMessage(RED + text);
return new mcMMOAmountsPrompt();
}
@ -652,15 +652,15 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = GOLD + "- Heroes Rewards -\n";
String text = GOLD + Lang.get("heroesRewardsTitle") + "\n";
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set classes (None set)\n";
text += GRAY + "2 - Set experience amounts (No classes set)\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("rewSetHeroesClasses") + " (" + Lang.get("noneSet") + ")\n";
text += GRAY + "2 - " + Lang.get("rewSetHeroesAmounts") + "(" + Lang.get("rewNoHeroesClasses") + ")\n";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
} else {
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set classes\n";
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - " + Lang.get("rewSetHeroesClasses") + "\n";
for (String s : getClasses(context)) {
text += GRAY + " - " + AQUA + s + "\n";
@ -668,10 +668,10 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
if (context.getSessionData(CK.REW_HEROES_AMOUNTS) == null) {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set experience amounts (None set)\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("rewSetHeroesAmounts") + " (" + Lang.get("noneSet") + ")\n";
} else {
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set experience amounts\n";
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - " + Lang.get("rewSetHeroesAmounts") + "\n";
for (Double d : getClassAmounts(context)) {
text += GRAY + " - " + AQUA + d + "\n";
@ -680,8 +680,8 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("clear") + "\n";
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("done");
}
@ -696,13 +696,13 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
return new HeroesClassesPrompt();
} else if (input.equalsIgnoreCase("2")) {
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
context.getForWhom().sendRawMessage(RED + "You must set classes first!");
context.getForWhom().sendRawMessage(RED + Lang.get("rewSetHeroesClassesFirst"));
return new HeroesListPrompt();
} else {
return new HeroesExperiencePrompt();
}
} else if (input.equalsIgnoreCase("3")) {
context.getForWhom().sendRawMessage(YELLOW + "Heroes rewards cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewHeroesCleared"));
context.setSessionData(CK.REW_HEROES_CLASSES, null);
context.setSessionData(CK.REW_HEROES_AMOUNTS, null);
return new HeroesListPrompt();
@ -726,7 +726,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if (one == two) {
return new RewardsPrompt(quests, factory);
} else {
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "classes list " + RED + "and " + GOLD + "experience amounts list " + RED + "are not the same size!");
context.getForWhom().sendRawMessage(RED + Lang.get("rewHeroesListsNotSameSize"));
return new HeroesListPrompt();
}
}
@ -749,14 +749,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = PURPLE + "- " + PINK + "Heroes Classes" + PURPLE + " -\n";
String text = PURPLE + Lang.get("heroesClassesTitle") + "\n";
LinkedList<String> list = new LinkedList<String>();
for (HeroClass hc : Quests.heroes.getClassManager().getClasses()) {
list.add(hc.getName());
}
if (list.isEmpty()) {
text += GRAY + "(None)\n";
text += GRAY + "(" + Lang.get("none") + ")\n";
} else {
Collections.sort(list);
@ -769,7 +769,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += YELLOW + "Enter Heroes classes separating each one by a space, or enter \"cancel\" to return.";
text += YELLOW + Lang.get("rewHeroesClassesPrompt");
return text;
}
@ -777,7 +777,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] arr = input.split(" ");
LinkedList<String> classes = new LinkedList<String>();
@ -786,7 +786,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
HeroClass hc = Quests.heroes.getClassManager().getClass(s);
if (hc == null) {
cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not a valid Heroes class name!");
String text = Lang.get("rewHeroesInvalidClass");
text = text.replaceAll("<input>", PINK + s + RED);
cc.getForWhom().sendRawMessage(RED + text);
return new HeroesClassesPrompt();
} else {
classes.add(hc.getName());
@ -810,9 +812,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = PURPLE + "- " + PINK + "Heroes Experience" + PURPLE + " -\n";
String text = Lang.get("heroesExperienceTitle") + "\n";
text += YELLOW + "Enter experience amounts (numbers, decimals are allowed) separating each one by a space, or enter \"cancel\" to return.";
text += YELLOW + Lang.get("rewHeroesExperiencePrompt");
return text;
}
@ -820,7 +822,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false) {
String[] arr = input.split(" ");
LinkedList<Double> amounts = new LinkedList<Double>();
@ -830,15 +832,12 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
try {
double d = Double.parseDouble(s);
if (d > 0) {
amounts.add(d);
} else {
cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not greater than zero!");
return new HeroesExperiencePrompt();
}
amounts.add(d);
} catch (NumberFormatException nfe) {
cc.getForWhom().sendRawMessage(RED + "Error: " + PINK + s + RED + " is not a number!");
String text = Lang.get("reqNotANumber");
text = text.replaceAll("<input>", PINK + s + RED);
cc.getForWhom().sendRawMessage(RED + text);
return new HeroesExperiencePrompt();
}
@ -859,7 +858,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext cc) {
String text = DARKAQUA + "- " + AQUA + "PhatLoots" + DARKAQUA + " -\n";
String text = DARKAQUA + Lang.get("phatLootsRewardsTitle") + "\n";
for (PhatLoot pl : PhatLootsAPI.getAllPhatLoots()) {
@ -867,7 +866,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
}
text += YELLOW + "Enter PhatLoots separating each one by a space, or enter \"clear\" to clear the list, or \"cancel\" to return.";
text += YELLOW + Lang.get("rewPhatLootsPrompt");
return text;
}
@ -875,7 +874,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public Prompt acceptInput(ConversationContext cc, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
String[] arr = input.split(" ");
LinkedList<String> loots = new LinkedList<String>();
@ -883,7 +882,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
for (String s : arr) {
if (PhatLootsAPI.getPhatLoot(s) == null) {
cc.getForWhom().sendRawMessage(DARKRED + s + RED + " is not a valid PhatLoot name!");
String text = Lang.get("rewPhatLootsInvalid");
text = text.replaceAll("<input>", DARKRED + s + RED);
cc.getForWhom().sendRawMessage(RED + text);
return new PhatLootsPrompt();
}
@ -893,10 +894,10 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
cc.setSessionData(CK.REW_PHAT_LOOTS, loots);
return new RewardsPrompt(quests, factory);
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
cc.setSessionData(CK.REW_PHAT_LOOTS, null);
cc.getForWhom().sendRawMessage(YELLOW + "PhatLoots reward cleared.");
cc.getForWhom().sendRawMessage(YELLOW + Lang.get("rewPhatLootsCleared"));
return new RewardsPrompt(quests, factory);
} else {
@ -910,21 +911,21 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
@Override
public String getPromptText(ConversationContext context) {
String text = PINK + "- Custom Rewards -\n";
String text = PINK + Lang.get("customRewardsTitle") + "\n";
if(quests.customRewards.isEmpty()){
text += BOLD + "" + PURPLE + "(No modules loaded)";
text += BOLD + "" + PURPLE + "(" + Lang.get("stageEditorNoModules") + ")";
}else {
for(CustomReward cr : quests.customRewards)
text += PURPLE + " - " + cr.getName() + "\n";
}
return text + YELLOW + "Enter the name of a custom reward to add, or enter \'clear\' to clear all custom rewards, or \'cancel\' to return.";
return text + YELLOW + Lang.get("rewCustomRewardPrompt");
}
@Override
public Prompt acceptInput(ConversationContext context, String input) {
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
if (input.equalsIgnoreCase(Lang.get("cmdCancel")) == false && input.equalsIgnoreCase(Lang.get("cmdClear")) == false) {
CustomReward found = null;
for(CustomReward cr : quests.customRewards){
@ -954,7 +955,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
context.setSessionData(CK.REW_CUSTOM, list);
context.setSessionData(CK.REW_CUSTOM_DATA, datamapList);
}else{
context.getForWhom().sendRawMessage(YELLOW + "That custom reward has already been added!");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewCustomAlreadyAdded"));
return new CustomRewardsPrompt();
}
}else{
@ -976,15 +977,15 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
//
}else{
context.getForWhom().sendRawMessage(YELLOW + "Custom reward module not found.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewCustomNotFound"));
return new CustomRewardsPrompt();
}
} else if (input.equalsIgnoreCase("clear")) {
} else if (input.equalsIgnoreCase(Lang.get("cmdClear"))) {
context.setSessionData(CK.REW_CUSTOM, null);
context.setSessionData(CK.REW_CUSTOM_DATA, null);
context.setSessionData(CK.REW_CUSTOM_DATA_TEMP, null);
context.getForWhom().sendRawMessage(YELLOW + "Custom rewards cleared.");
context.getForWhom().sendRawMessage(YELLOW + Lang.get("rewCustomCleared"));
}
return new RewardsPrompt(quests, factory);
@ -1019,13 +1020,13 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if(datamap.get(dataKey) != null)
text += GREEN + " (" + (String) datamap.get(dataKey) + ")\n";
else
text += RED + " (Value required)\n";
text += RED + " (" + Lang.get("valRequired") + ")\n";
index++;
}
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + "Finish";
text += BOLD + "" + DARKBLUE + index + " - " + AQUA + Lang.get("finish");
return text;
}
@ -1083,8 +1084,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
if(descriptions.get(temp) != null)
text += GOLD + descriptions.get(temp) + "\n";
text += YELLOW + "Enter value for ";
text += BOLD + temp + RESET + YELLOW + ":";
String lang = Lang.get("stageEditorCustomDataPrompt");
lang = lang.replaceAll("<data>", temp);
text += YELLOW + lang;
return text;
}

View File

@ -156,7 +156,7 @@ public class ItemUtil implements ColorUtil{
text += AQUA + " x " + is.getAmount();
if(is.getEnchantments().isEmpty() == false)
text += " " + PURPLE + "*Enchanted*";
text += " " + PURPLE + Lang.get("enchantedItem");
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,7 @@
package me.blackvein.quests.util;
import org.bukkit.entity.EntityType;
public class MiscUtil {
public static String getCapitalized(String s){
@ -55,4 +57,57 @@ public class MiscUtil {
return timeMilliSeconds;
}
public static String getProperMobName(EntityType type) {
String name = type.name().toLowerCase();
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
while(fixUnderscore(name) != null)
name = fixUnderscore(name);
return name;
}
public static EntityType getProperMobType(String properName) {
properName = unfixUnderscores(properName);
properName = properName.toUpperCase();
for(EntityType et : EntityType.values()) {
if(et.isAlive() && et.name().equalsIgnoreCase(properName))
return et;
}
return null;
}
private static String fixUnderscore(String s) {
int index = s.indexOf('_');
if(index == -1)
return null;
s = s.substring(0, (index + 1)) + Character.toUpperCase(s.charAt(index + 1)) + s.substring(index + 2);
s = s.replaceFirst("_", "");
return s;
}
private static String unfixUnderscores(String s) {
for(int i = 1; i < s.length(); i++) {
if(Character.isUpperCase(s.charAt(i))) {
s = s.substring(0, i) + "_" + s.substring(i);
}
}
return s;
}
}

View File

@ -1,3 +1,4 @@
language: "en"
allow-command-questing: true
allow-command-quests-with-npcs: false
show-requirements: true

View File

@ -1,6 +1,6 @@
name: Quests
main: me.blackvein.quests.Quests
version: 1.8.2
version: 1.9.0
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: https://github.com/Blackvein/Quests/