mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-22 09:08:05 +01:00
* Update to Bukkit 1.7.2
+ Added setStage command (usefull for commandblocks) * Implemented Fail_Quest function. + Fixed clear inventory not saving
This commit is contained in:
parent
fc745501e5
commit
caad018077
@ -53,7 +53,6 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
ConversationFactory convoCreator;
|
||||
File eventsFile;
|
||||
|
||||
@SuppressWarnings("LeakingThisInConstructor")
|
||||
public EventFactory(Quests plugin) {
|
||||
|
||||
quests = plugin;
|
||||
@ -187,6 +186,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
context.setSessionData(CK.E_NAME, null);
|
||||
context.setSessionData(CK.E_MESSAGE, null);
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, null);
|
||||
context.setSessionData(CK.E_FAIL_QUEST, null);
|
||||
context.setSessionData(CK.E_ITEMS, null);
|
||||
context.setSessionData(CK.E_ITEMS_AMOUNTS, null);
|
||||
context.setSessionData(CK.E_EXPLOSIONS, null);
|
||||
@ -219,6 +219,11 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
else
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
|
||||
|
||||
if (event.failQuest == true)
|
||||
context.setSessionData(CK.E_FAIL_QUEST, "Yes");
|
||||
else
|
||||
context.setSessionData(CK.E_FAIL_QUEST, "No");
|
||||
|
||||
if(event.items != null && event.items.isEmpty() == false){
|
||||
|
||||
LinkedList<ItemStack> items = new LinkedList<ItemStack>();
|
||||
@ -508,13 +513,18 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
context.setSessionData(CK.E_CLEAR_INVENTORY, "No");
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_FAIL_QUEST) == null) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, "No");
|
||||
}
|
||||
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - " + Lang.get("eventEditorClearInv") + ": " + AQUA + context.getSessionData(CK.E_CLEAR_INVENTORY) + "\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorFailQuest") + ": " + AQUA + context.getSessionData(CK.E_FAIL_QUEST) + "\n";
|
||||
|
||||
if (context.getSessionData(CK.E_ITEMS) == null) {
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorSetItems") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetItems") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - " + Lang.get("eventEditorSetItems") + "\n";
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetItems") + "\n";
|
||||
LinkedList<ItemStack> items = (LinkedList<ItemStack>) context.getSessionData(CK.E_ITEMS);
|
||||
|
||||
for (ItemStack is : items) {
|
||||
@ -526,10 +536,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_EXPLOSIONS) == null) {
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetExplosions") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("eventEditorSetExplosions") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - " + Lang.get("eventEditorSetExplosions") + "\n";
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("eventEditorSetExplosions") + "\n";
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EXPLOSIONS);
|
||||
|
||||
for (String loc : locations) {
|
||||
@ -541,10 +551,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_EFFECTS) == null) {
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("eventEditorSetEffects") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("eventEditorSetEffects") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - " + Lang.get("eventEditorSetEffects") + "\n";
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("eventEditorSetEffects") + "\n";
|
||||
LinkedList<String> effects = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS);
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_EFFECTS_LOCATIONS);
|
||||
|
||||
@ -557,24 +567,24 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_WORLD_STORM) == null) {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("eventEditorSetStorm") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("eventEditorSetStorm") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - " + Lang.get("eventEditorSetStorm") + " (" + AQUA + (String) context.getSessionData(CK.E_WORLD_STORM) + YELLOW + " -> " + DARKAQUA + Quests.getTime((Long) context.getSessionData(CK.E_WORLD_STORM_DURATION)) + YELLOW + ")\n";
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("eventEditorSetStorm") + " (" + AQUA + (String) context.getSessionData(CK.E_WORLD_STORM) + YELLOW + " -> " + DARKAQUA + Quests.getTime((Long) context.getSessionData(CK.E_WORLD_STORM_DURATION)) + YELLOW + ")\n";
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_WORLD_THUNDER) == null) {
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("eventEditorSetThunder") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetThunder") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - " + Lang.get("eventEditorSetThunder") + " (" + AQUA + (String) context.getSessionData(CK.E_WORLD_THUNDER) + YELLOW + " -> " + DARKAQUA + Quests.getTime((Long) context.getSessionData(CK.E_WORLD_THUNDER_DURATION)) + YELLOW + ")\n";
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetThunder") + " (" + AQUA + (String) context.getSessionData(CK.E_WORLD_THUNDER) + YELLOW + " -> " + DARKAQUA + Quests.getTime((Long) context.getSessionData(CK.E_WORLD_THUNDER_DURATION)) + YELLOW + ")\n";
|
||||
}
|
||||
|
||||
|
||||
if (context.getSessionData(CK.E_MOB_TYPES) == null) {
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "19" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_MOB_TYPES);
|
||||
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + "\n";
|
||||
text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - " + Lang.get("eventEditorSetMobSpawns") + "\n";
|
||||
|
||||
for (String s : types) {
|
||||
QuestMob qm = QuestMob.fromString(s);
|
||||
@ -583,10 +593,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_LIGHTNING) == null) {
|
||||
text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - " + Lang.get("eventEditorSetLightning") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("eventEditorSetLightning") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - " + Lang.get("eventEditorSetLightning") + "\n";
|
||||
text += BLUE + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("eventEditorSetLightning") + "\n";
|
||||
LinkedList<String> locations = (LinkedList<String>) context.getSessionData(CK.E_LIGHTNING);
|
||||
|
||||
for (String loc : locations) {
|
||||
@ -598,10 +608,10 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_POTION_TYPES) == null) {
|
||||
text += BLUE + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "12" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "11" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + "\n";
|
||||
text += BLUE + "" + BOLD + "12" + RESET + YELLOW + " - " + Lang.get("eventEditorSetPotionEffects") + "\n";
|
||||
LinkedList<String> types = (LinkedList<String>) context.getSessionData(CK.E_POTION_TYPES);
|
||||
LinkedList<Long> durations = (LinkedList<Long>) context.getSessionData(CK.E_POTION_DURATIONS);
|
||||
LinkedList<Integer> mags = (LinkedList<Integer>) context.getSessionData(CK.E_POTION_STRENGHT);
|
||||
@ -617,49 +627,49 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
if(context.getSessionData(CK.E_HUNGER) == null) {
|
||||
text += BLUE + "" + BOLD + "12" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHunger") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "13" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHunger") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "12" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHunger") + AQUA + " (" + (Integer)context.getSessionData(CK.E_HUNGER) + ")\n";
|
||||
text += BLUE + "" + BOLD + "13" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHunger") + AQUA + " (" + (Integer)context.getSessionData(CK.E_HUNGER) + ")\n";
|
||||
|
||||
}
|
||||
|
||||
if(context.getSessionData(CK.E_SATURATION) == null) {
|
||||
text += BLUE + "" + BOLD + "13" + RESET + YELLOW + " - " + Lang.get("eventEditorSetSaturation") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "14" + RESET + YELLOW + " - " + Lang.get("eventEditorSetSaturation") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "13" + RESET + YELLOW + " - " + Lang.get("eventEditorSetSaturation") + AQUA + " (" + (Integer)context.getSessionData(CK.E_SATURATION) + ")\n";
|
||||
text += BLUE + "" + BOLD + "14" + RESET + YELLOW + " - " + Lang.get("eventEditorSetSaturation") + AQUA + " (" + (Integer)context.getSessionData(CK.E_SATURATION) + ")\n";
|
||||
|
||||
}
|
||||
|
||||
if(context.getSessionData(CK.E_HEALTH) == null) {
|
||||
text += BLUE + "" + BOLD + "14" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHealth") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "15" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHealth") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "14" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHealth") + AQUA + " (" + (Integer)context.getSessionData(CK.E_HEALTH) + ")\n";
|
||||
text += BLUE + "" + BOLD + "15" + RESET + YELLOW + " - " + Lang.get("eventEditorSetHealth") + AQUA + " (" + (Integer)context.getSessionData(CK.E_HEALTH) + ")\n";
|
||||
|
||||
}
|
||||
|
||||
if(context.getSessionData(CK.E_TELEPORT) == null) {
|
||||
text += BLUE + "" + BOLD + "15" + RESET + YELLOW + " - " + Lang.get("eventEditorSetTeleport") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "16" + RESET + YELLOW + " - " + Lang.get("eventEditorSetTeleport") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "15" + RESET + YELLOW + " - " + Lang.get("eventEditorSetTeleport") + AQUA + " (" + (String)context.getSessionData(CK.E_TELEPORT) + ")\n";
|
||||
text += BLUE + "" + BOLD + "16" + RESET + YELLOW + " - " + Lang.get("eventEditorSetTeleport") + AQUA + " (" + (String)context.getSessionData(CK.E_TELEPORT) + ")\n";
|
||||
|
||||
}
|
||||
|
||||
if(context.getSessionData(CK.E_COMMANDS) == null) {
|
||||
text += BLUE + "" + BOLD + "16" + RESET + YELLOW + " - " + Lang.get("eventEditorSetCommands") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
text += BLUE + "" + BOLD + "17" + RESET + YELLOW + " - " + Lang.get("eventEditorSetCommands") + GRAY + " (" + Lang.get("noneSet") + ")\n";
|
||||
} else {
|
||||
|
||||
text += BLUE + "" + BOLD + "16" + RESET + YELLOW + " - " + Lang.get("eventEditorSetCommands") + "\n";
|
||||
text += BLUE + "" + BOLD + "17" + RESET + YELLOW + " - " + Lang.get("eventEditorSetCommands") + "\n";
|
||||
for(String s : (LinkedList<String>)context.getSessionData(CK.E_COMMANDS))
|
||||
text += GRAY + " - " + AQUA + s + "\n";
|
||||
|
||||
}
|
||||
|
||||
text += GREEN + "" + BOLD + "17" + RESET + YELLOW + " - " + Lang.get("done") + "\n";
|
||||
text += RED + "" + BOLD + "18" + RESET + YELLOW + " - " + Lang.get("quit");
|
||||
text += GREEN + "" + BOLD + "18" + RESET + YELLOW + " - " + Lang.get("done") + "\n";
|
||||
text += RED + "" + BOLD + "19" + RESET + YELLOW + " - " + Lang.get("quit");
|
||||
|
||||
return text;
|
||||
|
||||
@ -689,60 +699,71 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
|
||||
return new ItemListPrompt();
|
||||
String s = (String) context.getSessionData(CK.E_FAIL_QUEST);
|
||||
if (s.equalsIgnoreCase("Yes")) {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, "No");
|
||||
} else {
|
||||
context.setSessionData(CK.E_FAIL_QUEST, "Yes");
|
||||
}
|
||||
|
||||
return new CreateMenuPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
|
||||
return new ItemListPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
|
||||
selectedExplosionLocations.put((Player) context.getForWhom(), null);
|
||||
return new ExplosionPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
|
||||
return new EffectListPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
|
||||
return new StormPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
|
||||
return new ThunderPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
|
||||
return new MobPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
|
||||
selectedLightningLocations.put((Player) context.getForWhom(), null);
|
||||
return new LightningPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("11")) {
|
||||
} else if (input.equalsIgnoreCase("12")) {
|
||||
|
||||
return new PotionEffectPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("12")) {
|
||||
} else if (input.equalsIgnoreCase("13")) {
|
||||
|
||||
return new HungerPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("13")) {
|
||||
} else if (input.equalsIgnoreCase("14")) {
|
||||
|
||||
return new SaturationPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("14")) {
|
||||
} else if (input.equalsIgnoreCase("15")) {
|
||||
|
||||
return new HealthPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("15")){
|
||||
} else if (input.equalsIgnoreCase("16")){
|
||||
|
||||
selectedTeleportLocations.put((Player) context.getForWhom(), null);
|
||||
return new TeleportPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("16")) {
|
||||
} else if (input.equalsIgnoreCase("17")) {
|
||||
|
||||
return new CommandsPrompt();
|
||||
|
||||
} else if (input.equalsIgnoreCase("17")) {
|
||||
} else if (input.equalsIgnoreCase("18")) {
|
||||
|
||||
if(context.getSessionData(CK.E_OLD_EVENT) != null){
|
||||
return new FinishPrompt((String)context.getSessionData(CK.E_OLD_EVENT));
|
||||
@ -750,7 +771,7 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
return new FinishPrompt(null);
|
||||
}
|
||||
|
||||
} else if (input.equalsIgnoreCase("18")) {
|
||||
} else if (input.equalsIgnoreCase("19")) {
|
||||
|
||||
return new QuitPrompt();
|
||||
|
||||
@ -966,7 +987,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"))
|
||||
context.setSessionData("clear-inventory", "true");
|
||||
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"))
|
||||
section.set("fail-quest", true);
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.E_ITEMS) != null) {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import me.blackvein.quests.util.ReflectionUtil;
|
||||
import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum ParticleEffect {
|
||||
@ -51,7 +52,7 @@ public enum ParticleEffect {
|
||||
}
|
||||
|
||||
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
|
||||
Packet63WorldParticles packet = new Packet63WorldParticles();
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
|
||||
ReflectionUtil.setValue(packet, "a", particleName);
|
||||
ReflectionUtil.setValue(packet, "b", (float) location.getX());
|
||||
ReflectionUtil.setValue(packet, "c", (float) location.getY());
|
||||
|
@ -8,17 +8,22 @@ import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import me.blackvein.quests.exceptions.InvalidStageException;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import think.rpgitems.item.ItemManager;
|
||||
import think.rpgitems.item.RPGItem;
|
||||
|
||||
@ -89,7 +94,11 @@ public class Quest {
|
||||
} else {
|
||||
|
||||
q.currentStageIndex++;
|
||||
try {
|
||||
setStage(q, q.currentStageIndex);
|
||||
} catch (InvalidStageException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -103,40 +112,42 @@ public class Quest {
|
||||
|
||||
}
|
||||
|
||||
public void setStage(Quester q, int stage) {
|
||||
public void setStage(Quester quester, int stage) throws InvalidStageException {
|
||||
|
||||
quester.currentStageIndex = stage;
|
||||
|
||||
if (orderedStages.size() - 1 < stage) {
|
||||
return;
|
||||
throw new InvalidStageException(this, stage);
|
||||
}
|
||||
|
||||
q.resetObjectives();
|
||||
quester.resetObjectives();
|
||||
|
||||
if (q.currentStage.script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, q.getPlayer());
|
||||
if (quester.currentStage.script != null) {
|
||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, quester.getPlayer());
|
||||
}
|
||||
|
||||
if (q.currentStage.finishEvent != null) {
|
||||
q.currentStage.finishEvent.fire(q);
|
||||
if (quester.currentStage.finishEvent != null) {
|
||||
quester.currentStage.finishEvent.fire(quester);
|
||||
}
|
||||
|
||||
q.currentStage = orderedStages.get(stage);
|
||||
quester.currentStage = orderedStages.get(stage);
|
||||
|
||||
if (q.currentStage.startEvent != null) {
|
||||
q.currentStage.startEvent.fire(q);
|
||||
if (quester.currentStage.startEvent != null) {
|
||||
quester.currentStage.startEvent.fire(quester);
|
||||
}
|
||||
|
||||
q.addEmpties();
|
||||
quester.addEmpties();
|
||||
|
||||
q.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||
for (String s : q.getObjectives()) {
|
||||
quester.getPlayer().sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||
for (String s : quester.getObjectives()) {
|
||||
|
||||
q.getPlayer().sendMessage(s);
|
||||
quester.getPlayer().sendMessage(s);
|
||||
|
||||
}
|
||||
|
||||
String stageStartMessage = q.currentStage.startMessage;
|
||||
String stageStartMessage = quester.currentStage.startMessage;
|
||||
if (stageStartMessage != null) {
|
||||
q.getPlayer().sendMessage(Quests.parseString(stageStartMessage, q.currentQuest));
|
||||
quester.getPlayer().sendMessage(Quests.parseString(stageStartMessage, quester.currentQuest));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,18 +1,5 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import com.codisimus.plugins.phatloots.PhatLoots;
|
||||
import com.codisimus.plugins.phatloots.PhatLootsAPI;
|
||||
import me.blackvein.quests.util.ColorUtil;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
@ -33,9 +20,12 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import me.ThaH3lper.com.EpicBoss;
|
||||
import me.ThaH3lper.com.Mobs.EpicMobs;
|
||||
import me.blackvein.quests.exceptions.InvalidStageException;
|
||||
import me.blackvein.quests.prompts.QuestAcceptPrompt;
|
||||
import me.blackvein.quests.util.ColorUtil;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import me.blackvein.quests.util.MiscUtil;
|
||||
@ -47,6 +37,7 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.milkbowl.vault.Vault;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -78,10 +69,24 @@ import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import think.rpgitems.Plugin;
|
||||
import think.rpgitems.item.ItemManager;
|
||||
import think.rpgitems.item.RPGItem;
|
||||
|
||||
import com.codisimus.plugins.phatloots.PhatLoots;
|
||||
import com.codisimus.plugins.phatloots.PhatLootsAPI;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
import com.herocraftonline.heroes.Heroes;
|
||||
import com.herocraftonline.heroes.characters.Hero;
|
||||
import com.herocraftonline.heroes.characters.classes.HeroClass;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
|
||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
public final static Logger log = Logger.getLogger("Minecraft");
|
||||
@ -1142,7 +1147,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
} else if (args.length == 2) {
|
||||
} else if (args.length >= 2) {
|
||||
|
||||
if (args[0].equalsIgnoreCase("quit")) {
|
||||
|
||||
@ -1234,6 +1239,76 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("setstage")) {
|
||||
|
||||
if (cs.hasPermission("quests.admin.setstage")) {
|
||||
|
||||
Player target = null;
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
//To ensure the correct player is selected
|
||||
if (p.getName().equalsIgnoreCase(args[1])) {
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
//
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getName().toLowerCase().contains(args[1].toLowerCase())) {
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
int stage = -1;
|
||||
if (args.length > 2) {
|
||||
try {
|
||||
stage = Integer.parseInt(args[2]);
|
||||
} catch (NumberFormatException e) {
|
||||
cs.sendMessage(YELLOW + "Invalid number");
|
||||
}
|
||||
} else {
|
||||
cs.sendMessage(YELLOW + "Enter a stage");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
|
||||
cs.sendMessage(YELLOW + "Player not found.");
|
||||
|
||||
} else {
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
if (quester.currentQuest == null) {
|
||||
|
||||
cs.sendMessage(YELLOW + target.getName() + " does not currently have an active Quest.");
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
quester.currentQuest.setStage(quester, stage);
|
||||
} catch (InvalidStageException e) {
|
||||
cs.sendMessage(ChatColor.RED + "Advancing " + target.getName() + " to Stage: " + stage + ", has failed.");
|
||||
cs.sendMessage(ChatColor.RED + "Not enough stages.");
|
||||
}
|
||||
|
||||
quester.saveData();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + "You do not have access to that command.");
|
||||
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("finish")) {
|
||||
|
||||
if (cs.hasPermission("quests.admin.finish")) {
|
||||
|
@ -0,0 +1,32 @@
|
||||
package me.blackvein.quests.exceptions;
|
||||
|
||||
import me.blackvein.quests.Quest;
|
||||
|
||||
public class InvalidStageException extends Exception {
|
||||
|
||||
private Quest quest;
|
||||
private int stage;
|
||||
|
||||
public InvalidStageException(Quest quest, int stage) {
|
||||
this.quest = quest;
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public Quest getQuest() {
|
||||
return quest;
|
||||
}
|
||||
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1778748295752972651L;
|
||||
|
||||
@Override
|
||||
public void printStackTrace() {
|
||||
super.printStackTrace();
|
||||
}
|
||||
}
|
@ -100,6 +100,7 @@ public class CK {
|
||||
public static final String E_NAME = "evtName";
|
||||
public static final String E_MESSAGE = "evtMessage";
|
||||
public static final String E_CLEAR_INVENTORY = "evtClearInv";
|
||||
public static final String E_FAIL_QUEST = "evtFailQuest";
|
||||
public static final String E_ITEMS = "evtItems";
|
||||
public static final String E_ITEMS_AMOUNTS = "evtItemAmounts";
|
||||
public static final String E_EXPLOSIONS = "evtExplosions";
|
||||
|
@ -316,6 +316,7 @@ public class Lang {
|
||||
en.put("eventEditorSetMessage", "Set message");
|
||||
|
||||
en.put("eventEditorClearInv", "Clear player inventory");
|
||||
en.put("eventEditorFailQuest", "Fail the quest");
|
||||
en.put("eventEditorSetExplosions", "Set explosion locations");
|
||||
en.put("eventEditorSetLightning", "Set lightning strike locations");
|
||||
en.put("eventEditorSetEffects", "Set effects");
|
||||
|
@ -1,11 +1,12 @@
|
||||
package me.blackvein.quests.util;
|
||||
|
||||
import me.blackvein.quests.Quests;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
Loading…
Reference in New Issue
Block a user