mirror of
https://github.com/PikaMug/Quests.git
synced 2025-04-08 13:05:54 +02:00
Continuing GUI Display
This commit is contained in:
parent
a97b31c26a
commit
cbb9638d64
BIN
lib/Heroes.jar
BIN
lib/Heroes.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
lib/denizen-0.9.4-SNAPSHOT.jar
Normal file
BIN
lib/denizen-0.9.4-SNAPSHOT.jar
Normal file
Binary file not shown.
BIN
lib/mcMMO.jar
BIN
lib/mcMMO.jar
Binary file not shown.
19
pom.xml
19
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>1.8.1-SNAPSHOT</version>
|
||||
<version>1.8.2-SNAPSHOT</version>
|
||||
<name>quests</name>
|
||||
<url>http://dev.bukkit.org/server-mods/quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
@ -28,18 +28,18 @@
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<groupId>com.citizensnpcs</groupId>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.11</version>
|
||||
<version>2.0.13-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/citizensapi-2.0.11-SNAPSHOT.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/citizensapi-2.0.13-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aufdemrand</groupId>
|
||||
<artifactId>denizen</artifactId>
|
||||
<version>0.9.3-SNAPSHOT</version>
|
||||
<version>0.9.4-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/denizen-0.9.3-SNAPSHOT.jar</systemPath>
|
||||
<systemPath>${project.basedir}/lib/denizen-0.9.4-SNAPSHOT.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
@ -55,13 +55,6 @@
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/mcMMO.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>think.rpgitems</groupId>
|
||||
<artifactId>RPGItems2</artifactId>
|
||||
<version>3.0.4</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/lib/rpgitems2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.herocraftonline</groupId>
|
||||
<artifactId>Heroes</artifactId>
|
||||
|
@ -1,45 +0,0 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ItemUtil {
|
||||
|
||||
public static Quests plugin = null;
|
||||
|
||||
//Format - id-id:amount-amount:data-data:enchantment-enchantment level:name-name:lore-lore:
|
||||
public static ItemStack parseItem(String s){
|
||||
|
||||
String[] args = s.split(":");
|
||||
ItemStack stack = null;
|
||||
LinkedList<String> lore = new LinkedList<String>();
|
||||
|
||||
for(String arg : args){
|
||||
|
||||
if(arg.startsWith("id-"))
|
||||
stack = new ItemStack(Integer.parseInt(arg.substring(3)));
|
||||
else if(arg.startsWith("amount-"))
|
||||
stack.setAmount(Integer.parseInt(arg.substring(7)));
|
||||
else if(arg.startsWith("data-"))
|
||||
stack.setDurability(Short.parseShort(arg.substring(5)));
|
||||
else if(arg.startsWith("enchantment-")){
|
||||
String[] ench = arg.substring(12).split(" ");
|
||||
Enchantment e = Quests.getEnchantment(ench[0]);
|
||||
stack.addEnchantment(e, Integer.parseInt(ench[1]));
|
||||
}else if(arg.startsWith("name-"))
|
||||
stack.getItemMeta().setDisplayName(arg.substring(5));
|
||||
else if(arg.startsWith("lore-"))
|
||||
lore.add(arg.substring(5));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(lore.isEmpty() == false)
|
||||
stack.getItemMeta().setLore(lore);
|
||||
|
||||
return stack;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -89,11 +89,11 @@ public class NpcListener implements Listener {
|
||||
|
||||
if (q.npcStart != null && q.npcStart.getId() == evt.getNPC().getId()) {
|
||||
if (Quests.ignoreLockedQuests) {
|
||||
if (q.testRequirements(quester) && (q.redoDelay <= 0)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
} else {
|
||||
npcQuests.add(q);
|
||||
if (q.testRequirements(quester) && (q.redoDelay <= 0)) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
} else if (quester.completedQuests.contains(q.name) == false || q.redoDelay > -1) {
|
||||
npcQuests.add(q);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,6 +101,13 @@ public class NpcListener implements Listener {
|
||||
|
||||
if (npcQuests.isEmpty() == false && npcQuests.size() > 1) {
|
||||
|
||||
if(plugin.questNPCGUIs.contains(evt.getNPC().getId())) {
|
||||
|
||||
quester.showGUIDisplay(npcQuests);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
Conversation c = plugin.NPCConversationFactory.buildConversation((Conversable) player);
|
||||
c.getContext().setSessionData("quests", npcQuests);
|
||||
c.getContext().setSessionData("npc", evt.getNPC().getName());
|
||||
|
@ -1,10 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import me.blackvein.quests.util.ReflectionUtil;
|
||||
import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles;
|
||||
import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum ParticleEffect {
|
||||
|
@ -1,6 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -21,10 +25,12 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTameEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.*;
|
||||
import org.bukkit.event.player.PlayerFishEvent.State;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class PlayerListener implements Listener {
|
||||
public class PlayerListener implements Listener, ColorUtil {
|
||||
|
||||
final Quests plugin;
|
||||
|
||||
@ -164,6 +170,85 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent evt) {
|
||||
|
||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
||||
Player player = (Player) evt.getWhoClicked();
|
||||
|
||||
if (evt.getInventory().getTitle().equals("Quests")) {
|
||||
|
||||
ItemStack clicked = evt.getCurrentItem();
|
||||
if(clicked != null) {
|
||||
|
||||
for(Quest quest : plugin.quests) {
|
||||
|
||||
if(quest.guiDisplay != null) {
|
||||
|
||||
if(ItemUtil.compareItems(clicked, quest.guiDisplay, false) == 0) {
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
player.sendMessage(YELLOW + "You may only have one active Quest.");
|
||||
} else if (quester.completedQuests.contains(quest.name) && quest.redoDelay < 0) {
|
||||
player.sendMessage(YELLOW + "You have already completed " + PURPLE + quest.name + YELLOW + ".");
|
||||
} else {
|
||||
|
||||
boolean takeable = true;
|
||||
|
||||
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 + ".");
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (quest.region != null) {
|
||||
|
||||
boolean inRegion = false;
|
||||
Player p = quester.getPlayer();
|
||||
RegionManager rm = Quests.worldGuard.getRegionManager(p.getWorld());
|
||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||
while (it.hasNext()) {
|
||||
ProtectedRegion pr = it.next();
|
||||
if (pr.getId().equalsIgnoreCase(quest.region)) {
|
||||
inRegion = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (inRegion == false) {
|
||||
player.sendMessage(YELLOW + "You may not take " + AQUA + quest.name + YELLOW + " at this location.");
|
||||
takeable = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (takeable == true) {
|
||||
|
||||
quester.takeQuest(quest, false);
|
||||
|
||||
}
|
||||
|
||||
evt.getWhoClicked().closeInventory();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
evt.setCancelled(true);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerChat(AsyncPlayerChatEvent evt) {
|
||||
|
||||
|
@ -26,9 +26,6 @@ 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;
|
||||
|
||||
public class Quest {
|
||||
|
||||
public String name;
|
||||
@ -296,13 +293,6 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
|
||||
for (Integer i : rpgItemRewardIDs) {
|
||||
ItemStack is = ItemManager.getItemById(i).toItemStack(null);
|
||||
is.setAmount(rpgItemRewardAmounts.get(rpgItemRewardIDs.indexOf(i)));
|
||||
Quests.addItem(player, is);
|
||||
none = null;
|
||||
}
|
||||
|
||||
for (String s : commands) {
|
||||
|
||||
s = s.replaceAll("<player>", player.getName());
|
||||
@ -384,13 +374,6 @@ public class Quest {
|
||||
none = null;
|
||||
}
|
||||
|
||||
for (Integer i : rpgItemRewardIDs) {
|
||||
|
||||
RPGItem item = ItemManager.getItemById(i);
|
||||
player.sendMessage("- " + ChatColor.LIGHT_PURPLE + "- " + ChatColor.ITALIC + item.getName() + ChatColor.GRAY + " x " + rpgItemRewardAmounts.get(rpgItemRewardIDs.indexOf(i)));
|
||||
|
||||
}
|
||||
|
||||
for (ItemStack i : itemRewards) {
|
||||
|
||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||
|
@ -272,9 +272,18 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
}
|
||||
|
||||
if (quests.citizens != null) {
|
||||
text += GRAY + "9 - Set GUI Item Display (Feature coming soon)\n";
|
||||
|
||||
if(context.getSessionData(CK.Q_GUIDISPLAY) == null) {
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set GUI Item Display (None set)\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";
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
text += GRAY + "8 - Set GUI Item Display (Feature coming soon)\n";
|
||||
text += GRAY + "8 - Set GUI Item Display (Citizens not installed) \n";
|
||||
}
|
||||
|
||||
if (quests.citizens != null) {
|
||||
@ -365,13 +374,13 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
if (quests.citizens != null) {
|
||||
return new InitialEventPrompt();
|
||||
} else {
|
||||
return new CreateMenuPrompt();
|
||||
return new GUIDisplayPrompt();
|
||||
}
|
||||
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
|
||||
if (quests.citizens != null) {
|
||||
return new CreateMenuPrompt();
|
||||
return new GUIDisplayPrompt();
|
||||
} else {
|
||||
return new RequirementsPrompt(quests, QuestFactory.this);
|
||||
}
|
||||
@ -792,8 +801,31 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
if(context.getSessionData("tempStack") != null){
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, context.getSessionData("tempStack"));
|
||||
|
||||
ItemStack stack = (ItemStack) context.getSessionData("tempStack");
|
||||
boolean failed = false;
|
||||
|
||||
for(Quest quest : quests.quests) {
|
||||
|
||||
if(quest.guiDisplay != null) {
|
||||
|
||||
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);
|
||||
failed = true;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!failed)
|
||||
context.setSessionData(CK.Q_GUIDISPLAY, context.getSessionData("tempStack"));
|
||||
|
||||
context.setSessionData("tempStack", null);
|
||||
|
||||
}
|
||||
|
||||
String text = GREEN + "- GUI Item Display -\n";
|
||||
@ -804,8 +836,8 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
text += DARKGREEN + "Current item: " + GRAY + "(None)\n\n";
|
||||
}
|
||||
text += GREEN + "" + BOLD + "1 -" + RESET + DARKGREEN + " Set Item\n";
|
||||
text += GREEN + "" + BOLD + "1 -" + RESET + DARKGREEN + " Clear Item\n";
|
||||
text += GREEN + "" + BOLD + "1 -" + RESET + GREEN + " Done\n";
|
||||
text += GREEN + "" + BOLD + "2 -" + RESET + DARKGREEN + " Clear Item\n";
|
||||
text += GREEN + "" + BOLD + "3 -" + RESET + GREEN + " Done\n";
|
||||
|
||||
|
||||
return text;
|
||||
@ -1082,6 +1114,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
String blockStart = null;
|
||||
String initialEvent = null;
|
||||
String region = null;
|
||||
ItemStack guiDisplay = null;
|
||||
|
||||
Integer moneyReq = null;
|
||||
Integer questPointsReq = null;
|
||||
@ -1181,6 +1214,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
region = (String) cc.getSessionData(CK.Q_REGION);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(CK.Q_GUIDISPLAY) != null) {
|
||||
guiDisplay = (ItemStack) cc.getSessionData(CK.Q_GUIDISPLAY);
|
||||
}
|
||||
|
||||
if (cc.getSessionData(CK.REW_MONEY) != null) {
|
||||
moneyRew = (Integer) cc.getSessionData(CK.REW_MONEY);
|
||||
}
|
||||
@ -1196,17 +1233,6 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
}
|
||||
}
|
||||
|
||||
if (cc.getSessionData(CK.REW_RPG_ITEM_IDS) != null) {
|
||||
RPGItemRews = new LinkedList<Integer>();
|
||||
RPGItemAmounts = new LinkedList<Integer>();
|
||||
for (Integer i : (LinkedList<Integer>) cc.getSessionData(CK.REW_RPG_ITEM_IDS)) {
|
||||
RPGItemRews.add(i);
|
||||
}
|
||||
for (Integer i : (LinkedList<Integer>) cc.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)) {
|
||||
RPGItemAmounts.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (cc.getSessionData(CK.REW_EXP) != null) {
|
||||
expRew = (Integer) cc.getSessionData(CK.REW_EXP);
|
||||
}
|
||||
@ -1246,6 +1272,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
cs.set("finish-message", finish);
|
||||
cs.set("initial-event", initialEvent);
|
||||
cs.set("region", region);
|
||||
cs.set("guiDisplay", ItemUtil.serialize(guiDisplay));
|
||||
|
||||
if (moneyReq != null || questPointsReq != null || itemReqs != null && itemReqs.isEmpty() == false || permReqs != null && permReqs.isEmpty() == false || (questReqs != null && questReqs.isEmpty() == false) || (questBlocks != null && questBlocks.isEmpty() == false) || (mcMMOSkillReqs != null && mcMMOSkillReqs.isEmpty() == false) || heroesPrimaryReq != null || heroesSecondaryReq != null || customReqs != null) {
|
||||
|
||||
@ -1825,11 +1852,6 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
|
||||
}
|
||||
|
||||
if (q.rpgItemRewardIDs.isEmpty() == false) {
|
||||
cc.setSessionData(CK.REW_RPG_ITEM_IDS, q.rpgItemRewardIDs);
|
||||
cc.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, q.rpgItemRewardAmounts);
|
||||
}
|
||||
|
||||
if (q.heroesClasses.isEmpty() == false) {
|
||||
cc.setSessionData(CK.REW_HEROES_CLASSES, q.heroesClasses);
|
||||
cc.setSessionData(CK.REW_HEROES_AMOUNTS, q.heroesAmounts);
|
||||
|
@ -8,6 +8,7 @@ import java.util.logging.Level;
|
||||
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -2926,4 +2927,26 @@ public class Quester {
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
public void showGUIDisplay(LinkedList<Quest> quests) {
|
||||
|
||||
Player player = getPlayer();
|
||||
int size = ((quests.size() / 9) + 1) * 9;
|
||||
|
||||
Inventory inv = Bukkit.getServer().createInventory(player, size, "Quests");
|
||||
|
||||
int inc = 0;
|
||||
for(int i = 0; i < quests.size(); i++) {
|
||||
|
||||
if(quests.get(i).guiDisplay != null) {
|
||||
inv.setItem(inc, quests.get(i).guiDisplay);
|
||||
inc++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
player.openInventory(inv);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,10 +63,6 @@ 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;
|
||||
@ -99,7 +95,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
public static Permission permission = null;
|
||||
public static WorldGuardPlugin worldGuard = null;
|
||||
public static mcMMO mcmmo = null;
|
||||
public static Plugin rpgItems = null;
|
||||
public static Heroes heroes = null;
|
||||
public static PhatLoots phatLoots = null;
|
||||
public static boolean snoop = true;
|
||||
@ -119,6 +114,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
public final LinkedList<Quest> quests = new LinkedList<Quest>();
|
||||
public final LinkedList<Event> events = new LinkedList<Event>();
|
||||
public final LinkedList<NPC> questNPCs = new LinkedList<NPC>();
|
||||
public final LinkedList<Integer> questNPCGUIs = new LinkedList<Integer>();
|
||||
public ConversationFactory conversationFactory;
|
||||
public ConversationFactory NPCConversationFactory;
|
||||
public QuestFactory questFactory;
|
||||
@ -190,18 +186,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
mcmmo = (mcMMO) getServer().getPluginManager().getPlugin("mcMMO");
|
||||
}
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("RPG Items") != null) {
|
||||
rpgItems = (Plugin) getServer().getPluginManager().getPlugin("RPG Items");
|
||||
}
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("Heroes") != null) {
|
||||
heroes = (Heroes) getServer().getPluginManager().getPlugin("Heroes");
|
||||
}
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("RPG Items") != null) {
|
||||
rpgItems = think.rpgitems.Plugin.plugin;
|
||||
}
|
||||
|
||||
|
||||
if (getServer().getPluginManager().getPlugin("PhatLoots") != null) {
|
||||
phatLoots = (PhatLoots) getServer().getPluginManager().getPlugin("PhatLoots");
|
||||
}
|
||||
@ -267,6 +255,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (new File(this.getDataFolder(), "data.yml").exists() == false) {
|
||||
printInfo("[Quests] Data file not found, writing default to file.");
|
||||
FileConfiguration data = new YamlConfiguration();
|
||||
data.options().copyHeader(true);
|
||||
data.options().copyDefaults(true);
|
||||
try {
|
||||
data.load(this.getResource("data.yml"));
|
||||
data.save(new File(this.getDataFolder(), "data.yml"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getServer().getPluginManager().registerEvents(pListener, this);
|
||||
if (npcEffects) {
|
||||
@ -432,6 +436,26 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
public void loadData() {
|
||||
|
||||
YamlConfiguration config = new YamlConfiguration();
|
||||
File dataFile = new File(this.getDataFolder(), "data.yml");
|
||||
|
||||
try {
|
||||
config.load(dataFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(config.contains("npc-gui")) {
|
||||
|
||||
List<Integer> ids = config.getIntegerList("npc-gui");
|
||||
questNPCGUIs.addAll(ids);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void loadModules() {
|
||||
|
||||
File f = new File(this.getDataFolder(), "modules");
|
||||
@ -1764,6 +1788,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
cs.sendMessage(RED + "You do not have access to that command.");
|
||||
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("togglegui")) {
|
||||
|
||||
if (cs.hasPermission("quests.admin.togglegui")) {
|
||||
|
||||
try {
|
||||
|
||||
int i = Integer.parseInt(args[1]);
|
||||
if (citizens.getNPCRegistry().getById(i) == null) {
|
||||
cs.sendMessage(RED + "Error: There is no NPC with ID " + PURPLE + i);
|
||||
}else if (questNPCGUIs.contains(i)) {
|
||||
questNPCGUIs.remove(i);
|
||||
a
|
||||
}
|
||||
|
||||
} catch (NumberFormatException nfe) {
|
||||
cs.sendMessage(RED + "Input was not a number! Usage: /questadmin togglegui <npc id>");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
cs.sendMessage(RED + "An unknown error occurred. See console output.");
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
cs.sendMessage(RED + "You do not have access to that command.");
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -1810,6 +1860,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
if (cs.hasPermission("quests.admin.nextstage")) {
|
||||
cs.sendMessage(DARKRED + "/questadmin nextstage <player>" + RED + " - Immediately force Stage completion for a player");
|
||||
}
|
||||
if (citizens != null && cs.hasPermission("quests.admin.togglegui")) {
|
||||
cs.sendMessage(DARKRED + "/questadmin togglegui <npc id>" + RED + " - Toggle GUI Quest Display on an NPC");
|
||||
}
|
||||
if (cs.hasPermission("quests.admin.reload")) {
|
||||
cs.sendMessage(DARKRED + "/questadmin reload" + RED + " - Reload all Quests");
|
||||
}
|
||||
@ -3565,61 +3618,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".rewards.rpgitem-ids")) {
|
||||
|
||||
if (Quests.checkList(config.getList("quests." + s + ".rewards.rpgitem-ids"), Integer.class)) {
|
||||
|
||||
if (config.contains("quests." + s + ".rewards.rpgitem-amounts")) {
|
||||
|
||||
if (Quests.checkList(config.getList("quests." + s + ".rewards.rpgitem-amounts"), Integer.class)) {
|
||||
|
||||
boolean failed = false;
|
||||
for (Integer id : config.getIntegerList("quests." + s + ".rewards.rpgitem-ids")) {
|
||||
|
||||
try {
|
||||
RPGItem item = ItemManager.getItemById(id);
|
||||
if (item != null) {
|
||||
quest.rpgItemRewardIDs.add(id);
|
||||
} else {
|
||||
printSevere("[Quests] " + id + " in rpgitem-ids: Reward in Quest " + quest.name + " is not a valid RPGItem id!");
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
printSevere("[Quests] " + id + " in rpgitem-ids: Reward in Quest " + quest.name + " is not properly formatted!");
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (Integer amount : config.getIntegerList("quests." + s + ".rewards.rpgitem-amounts")) {
|
||||
|
||||
quest.rpgItemRewardAmounts.add(amount);
|
||||
|
||||
}
|
||||
|
||||
if (failed) {
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
printSevere("[Quests] rpgitem-amounts: Reward in Quest " + quest.name + " is not a list of numbers!");
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
printSevere("[Quests] Rewards for Quest " + quest.name + " is missing rpgitem-amounts");
|
||||
continue;
|
||||
}
|
||||
|
||||
} else {
|
||||
printSevere("[Quests] rpgitem-ids: Reward in Quest " + quest.name + " is not a list of numbers!");
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (config.contains("quests." + s + ".rewards.money")) {
|
||||
|
||||
if (config.getInt("quests." + s + ".rewards.money", -999) != -999) {
|
||||
@ -5080,5 +5078,25 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
return hero.getHeroClass().getName().equalsIgnoreCase(secondaryClass);
|
||||
|
||||
}
|
||||
|
||||
public void updateData() {
|
||||
|
||||
aYamlConfiguration config = new YamlConfiguration();
|
||||
File dataFile = new File(this.getDataFolder(), "data.yml");
|
||||
|
||||
try {
|
||||
config.load(dataFile);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if(config.contains("npc-gui")) {
|
||||
|
||||
List<Integer> ids = config.getIntegerList("npc-gui");
|
||||
questNPCGUIs.addAll(ids);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ import org.bukkit.conversations.NumericPrompt;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import think.rpgitems.item.ItemManager;
|
||||
import think.rpgitems.item.RPGItem;
|
||||
|
||||
public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
@ -33,7 +31,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
public RewardsPrompt(Quests plugin, QuestFactory qf) {
|
||||
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12");
|
||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11");
|
||||
quests = plugin;
|
||||
factory = qf;
|
||||
|
||||
@ -61,41 +59,16 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Set item rewards\n";
|
||||
|
||||
//RPGItems
|
||||
if (Quests.rpgItems != null) {
|
||||
|
||||
if (context.getSessionData(CK.REW_RPG_ITEM_IDS) == null) {
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set RPGItem rewards\n";
|
||||
List<Integer> rpgItems = (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS);
|
||||
List<Integer> rpgItemAmounts = (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS);
|
||||
|
||||
for (Integer i : rpgItems) {
|
||||
|
||||
RPGItem item = ItemManager.getItemById(i);
|
||||
text += GRAY + " - " + PINK + ITALIC + item.getName() + RESET + GRAY + " x " + PURPLE + rpgItemAmounts.get(rpgItems.indexOf(i)) + "\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
text += GRAY + "4 - Set RPGItem rewards (RPGItems not installed)\n";
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
if (context.getSessionData(CK.REW_EXP) == null) {
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (None set)\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
|
||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Set experience reward (" + context.getSessionData(CK.REW_EXP) + " points)\n";
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REW_COMMAND) == null) {
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set command rewards\n";
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set command rewards\n";
|
||||
List<String> commands = (List<String>) context.getSessionData(CK.REW_COMMAND);
|
||||
|
||||
for (String cmd : commands) {
|
||||
@ -106,9 +79,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REW_PERMISSION) == null) {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set permission rewards\n";
|
||||
text += BLUE + "" + BOLD + "6" + RESET + YELLOW + " - Set permission rewards\n";
|
||||
List<String> permissions = (List<String>) context.getSessionData(CK.REW_PERMISSION);
|
||||
|
||||
for (String perm : permissions) {
|
||||
@ -121,9 +94,9 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
if (Quests.mcmmo != null) {
|
||||
|
||||
if (context.getSessionData(CK.REW_MCMMO_SKILLS) == null) {
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
|
||||
text += BLUE + "" + BOLD + "7" + RESET + YELLOW + " - Set mcMMO skill rewards\n";
|
||||
List<String> skills = (List<String>) context.getSessionData(CK.REW_MCMMO_SKILLS);
|
||||
List<Integer> amounts = (List<Integer>) context.getSessionData(CK.REW_MCMMO_AMOUNTS);
|
||||
|
||||
@ -136,16 +109,16 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
} else {
|
||||
|
||||
text += GRAY + "8 - Set mcMMO skill rewards (mcMMO not installed)\n";
|
||||
text += GRAY + "7 - Set mcMMO skill rewards (mcMMO not installed)\n";
|
||||
|
||||
}
|
||||
|
||||
if (Quests.heroes != null) {
|
||||
|
||||
if (context.getSessionData(CK.REW_HEROES_CLASSES) == null) {
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set Heroes experience rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes experience rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set Heroes experience rewards\n";
|
||||
text += BLUE + "" + BOLD + "8" + RESET + YELLOW + " - Set Heroes experience rewards\n";
|
||||
List<String> heroClasses = (List<String>) context.getSessionData(CK.REW_HEROES_CLASSES);
|
||||
List<Double> amounts = (List<Double>) context.getSessionData(CK.REW_HEROES_AMOUNTS);
|
||||
|
||||
@ -158,16 +131,16 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
} else {
|
||||
|
||||
text += GRAY + "9 - Set Heroes experience rewards (Heroes not installed)\n";
|
||||
text += GRAY + "8 - Set Heroes experience rewards (Heroes not installed)\n";
|
||||
|
||||
}
|
||||
|
||||
if (Quests.phatLoots != null) {
|
||||
|
||||
if (context.getSessionData(CK.REW_PHAT_LOOTS) == null) {
|
||||
text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - Set PhatLoot rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set PhatLoot rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "10" + RESET + YELLOW + " - Set PhatLoot rewards\n";
|
||||
text += BLUE + "" + BOLD + "9" + RESET + YELLOW + " - Set PhatLoot rewards\n";
|
||||
List<String> phatLoots = (List<String>) context.getSessionData(CK.REW_PHAT_LOOTS);
|
||||
|
||||
for (String phatLoot : phatLoots) {
|
||||
@ -179,14 +152,14 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
} else {
|
||||
|
||||
text += GRAY + "10 - Set PhatLoot rewards (PhatLoots not installed)\n";
|
||||
text += GRAY + "9 - Set PhatLoot rewards (PhatLoots not installed)\n";
|
||||
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REW_CUSTOM) == null) {
|
||||
text += BLUE + "" + BOLD + "11 - " + RESET + ITALIC + PURPLE + "Custom Rewards (None set)\n";
|
||||
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + "Custom Rewards (None set)\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "11 - " + RESET + ITALIC + PURPLE + "Custom Rewards\n";
|
||||
text += BLUE + "" + BOLD + "10 - " + RESET + ITALIC + PURPLE + "Custom Rewards\n";
|
||||
LinkedList<String> customRews = (LinkedList<String>) context.getSessionData(CK.REW_CUSTOM);
|
||||
for(String s : customRews){
|
||||
|
||||
@ -195,7 +168,7 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
}
|
||||
}
|
||||
|
||||
text += GREEN + "" + BOLD + "12" + RESET + YELLOW + " - Done";
|
||||
text += GREEN + "" + BOLD + "11" + RESET + YELLOW + " - Done";
|
||||
|
||||
return text;
|
||||
|
||||
@ -211,38 +184,32 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
return new ItemListPrompt();
|
||||
} else if (input.equalsIgnoreCase("4")) {
|
||||
if (Quests.rpgItems != null) {
|
||||
return new RPGItemsPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
return new ExperiencePrompt();
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
} else if (input.equalsIgnoreCase("5")) {
|
||||
return new CommandsPrompt();
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
} else if (input.equalsIgnoreCase("6")) {
|
||||
return new PermissionsPrompt();
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
} else if (input.equalsIgnoreCase("7")) {
|
||||
if (Quests.mcmmo != null) {
|
||||
return new mcMMOListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
} else if (input.equalsIgnoreCase("8")) {
|
||||
if (Quests.heroes != null) {
|
||||
return new HeroesListPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
} else if (input.equalsIgnoreCase("10")) {
|
||||
} else if (input.equalsIgnoreCase("9")) {
|
||||
if (Quests.phatLoots != null) {
|
||||
return new PhatLootsPrompt();
|
||||
} else {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
}
|
||||
}else if(input.equalsIgnoreCase("11")){
|
||||
}else if(input.equalsIgnoreCase("10")){
|
||||
return new CustomRewardsPrompt();
|
||||
}else if (input.equalsIgnoreCase("12")) {
|
||||
}else if (input.equalsIgnoreCase("11")) {
|
||||
return factory.returnToMenu();
|
||||
}
|
||||
return null;
|
||||
@ -403,190 +370,6 @@ public class RewardsPrompt extends FixedSetPrompt implements ColorUtil {
|
||||
|
||||
}
|
||||
|
||||
private class RPGItemsPrompt extends FixedSetPrompt {
|
||||
|
||||
public RPGItemsPrompt() {
|
||||
|
||||
super("1", "2", "3");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
|
||||
String text = GOLD + "- RPGItem Rewards -\n";
|
||||
if (context.getSessionData(CK.REW_RPG_ITEM_IDS) == null) {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set IDs\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS)) {
|
||||
text += AQUA + " - " + i + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) == null) {
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
|
||||
} else {
|
||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set amounts\n";
|
||||
for (Integer i : (List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)) {
|
||||
text += AQUA + " - " + i + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Done";
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
||||
|
||||
if (input.equalsIgnoreCase("1")) {
|
||||
return new RPGItemIdsPrompt();
|
||||
} else if (input.equalsIgnoreCase("2")) {
|
||||
return new RPGItemAmountsPrompt();
|
||||
} else if (input.equalsIgnoreCase("3")) {
|
||||
|
||||
int one;
|
||||
int two;
|
||||
|
||||
if (context.getSessionData(CK.REW_RPG_ITEM_IDS) != null) {
|
||||
one = ((List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_IDS)).size();
|
||||
} else {
|
||||
one = 0;
|
||||
}
|
||||
|
||||
if (context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS) != null) {
|
||||
two = ((List<Integer>) context.getSessionData(CK.REW_RPG_ITEM_AMOUNTS)).size();
|
||||
} else {
|
||||
two = 0;
|
||||
}
|
||||
|
||||
if (one == two) {
|
||||
return new RewardsPrompt(quests, factory);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(RED + "The " + GOLD + "IDs list " + RED + "and " + GOLD + "amounts list " + RED + "are not the same size!");
|
||||
return new RPGItemsPrompt();
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class RPGItemIdsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return YELLOW + "Enter RPGItem IDs (or names) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
|
||||
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == false) {
|
||||
|
||||
String[] args = input.split(" ");
|
||||
LinkedList<Integer> ids = new LinkedList<Integer>();
|
||||
for (String s : args) {
|
||||
|
||||
try {
|
||||
|
||||
int id = Integer.parseInt(s);
|
||||
|
||||
if (ids.contains(id)) {
|
||||
context.getForWhom().sendRawMessage(RED + "Error: List contains duplicates!");
|
||||
return new RPGItemIdsPrompt();
|
||||
}
|
||||
|
||||
RPGItem item = ItemManager.getItemById(id);
|
||||
|
||||
if (item != null) {
|
||||
ids.add(id);
|
||||
} else {
|
||||
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
|
||||
return new RPGItemIdsPrompt();
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
|
||||
RPGItem item = ItemManager.getItemByName(s);
|
||||
|
||||
if (item == null) {
|
||||
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ", not an RPGItem ID or name!");
|
||||
return new RPGItemIdsPrompt();
|
||||
} else {
|
||||
ids.add(item.getID());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
context.setSessionData(CK.REW_RPG_ITEM_IDS, ids);
|
||||
|
||||
} else if (input.equalsIgnoreCase("clear")) {
|
||||
|
||||
context.setSessionData(CK.REW_RPG_ITEM_IDS, null);
|
||||
context.getForWhom().sendRawMessage(YELLOW + "RPGItem IDs cleared.");
|
||||
|
||||
}
|
||||
|
||||
return new RPGItemsPrompt();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class RPGItemAmountsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return YELLOW + "Enter RPGItem amounts (numbers) separating each one by a space, or enter \'clear\' to clear the list, or \'cancel\' to return.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String input) {
|
||||
|
||||
if (input.equalsIgnoreCase("cancel") == false && input.equalsIgnoreCase("clear") == 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 RPGItemAmountsPrompt();
|
||||
}
|
||||
|
||||
} catch (NumberFormatException e) {
|
||||
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
|
||||
return new RPGItemAmountsPrompt();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, amounts);
|
||||
|
||||
} else if (input.equalsIgnoreCase("clear")) {
|
||||
|
||||
context.setSessionData(CK.REW_RPG_ITEM_AMOUNTS, null);
|
||||
context.getForWhom().sendRawMessage(YELLOW + "RPGItem amounts cleared.");
|
||||
|
||||
}
|
||||
|
||||
return new RPGItemsPrompt();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class CommandsPrompt extends StringPrompt {
|
||||
|
||||
@Override
|
||||
|
@ -39,8 +39,6 @@ public class CK {
|
||||
public static final String REW_MONEY = "moneyRew";
|
||||
public static final String REW_QUEST_POINTS = "questPointsRew";
|
||||
public static final String REW_ITEMS = "itemRews";
|
||||
public static final String REW_RPG_ITEM_IDS = "rpgItemRewIDs";
|
||||
public static final String REW_RPG_ITEM_AMOUNTS = "rpgItemRewAmounts";
|
||||
public static final String REW_EXP = "expRew";
|
||||
public static final String REW_COMMAND = "commandRews";
|
||||
public static final String REW_PERMISSION = "permissionRews";
|
||||
|
@ -4,9 +4,9 @@ import me.blackvein.quests.Quests;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
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.craftbukkit.v1_7_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
0
src/main/resources/data.yml
Normal file
0
src/main/resources/data.yml
Normal file
@ -61,6 +61,9 @@ permissions:
|
||||
quests.admin.nextstage:
|
||||
description: Immediately force Stage completion for a player
|
||||
default: op
|
||||
quests.admin.togglegui:
|
||||
description: Toggle GUI Quest Display on NPC's
|
||||
default: op
|
||||
quests.admin.reload:
|
||||
description: Reload all Quests
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user