mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-22 09:08:05 +01:00
Fixed vanishing item rewards and enchantments
This commit is contained in:
parent
fcbce57f6b
commit
91c7e5a26c
@ -129,9 +129,9 @@ public class Quest {
|
|||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, quester.getPlayer());
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, quester.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quester.currentStage.finishEvent != null) {
|
/*if (quester.currentStage.finishEvent != null) {
|
||||||
quester.currentStage.finishEvent.fire(quester);
|
quester.currentStage.finishEvent.fire(quester);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
quester.currentStage = orderedStages.get(stage);
|
quester.currentStage = orderedStages.get(stage);
|
||||||
|
|
||||||
@ -389,11 +389,26 @@ public class Quest {
|
|||||||
for (ItemStack i : itemRewards) {
|
for (ItemStack i : itemRewards) {
|
||||||
|
|
||||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
} else if (i.getDurability() != 0) {
|
} else if (i.getDurability() != 0) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
none = null;
|
none = null;
|
||||||
@ -402,11 +417,26 @@ public class Quest {
|
|||||||
for (ItemStack i : phatLootItems) {
|
for (ItemStack i : phatLootItems) {
|
||||||
|
|
||||||
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
if (i.hasItemMeta() && i.getItemMeta().hasDisplayName()) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_AQUA + ChatColor.ITALIC + i.getItemMeta().getDisplayName() + ChatColor.RESET + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
} else if (i.getDurability() != 0) {
|
} else if (i.getDurability() != 0) {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ":" + i.getDurability() + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
|
|
||||||
|
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*");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
none = null;
|
none = null;
|
||||||
|
@ -1511,8 +1511,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
stage.set("finish-event", finishEvent);
|
stage.set("finish-event", finishEvent);
|
||||||
stage.set("death-event", deathEvent);
|
stage.set("death-event", deathEvent);
|
||||||
stage.set("disconnect-event", disconnectEvent);
|
stage.set("disconnect-event", disconnectEvent);
|
||||||
stage.set("chat-events", chatEvents);
|
if(chatEvents != null && chatEvents.isEmpty() == false){
|
||||||
stage.set("chat-event-triggers", chatEventTriggers);
|
stage.set("chat-events", chatEvents);
|
||||||
|
stage.set("chat-event-triggers", chatEventTriggers);
|
||||||
|
}
|
||||||
stage.set("delay", delay);
|
stage.set("delay", delay);
|
||||||
stage.set("delay-message", delayMessage);
|
stage.set("delay-message", delayMessage);
|
||||||
stage.set("start-message", startMessage);
|
stage.set("start-message", startMessage);
|
||||||
@ -1644,6 +1646,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
|||||||
if (q.exp != 0) {
|
if (q.exp != 0) {
|
||||||
cc.setSessionData(CK.REW_EXP, q.exp);
|
cc.setSessionData(CK.REW_EXP, q.exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(q.itemRewards.isEmpty() == false) {
|
||||||
|
cc.setSessionData(CK.REW_ITEMS, q.itemRewards);
|
||||||
|
}
|
||||||
|
|
||||||
if (q.commands.isEmpty() == false) {
|
if (q.commands.isEmpty() == false) {
|
||||||
cc.setSessionData(CK.REW_COMMAND, q.commands);
|
cc.setSessionData(CK.REW_COMMAND, q.commands);
|
||||||
|
@ -429,46 +429,46 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadModules() {
|
public void loadModules() {
|
||||||
|
|
||||||
File f = new File(this.getDataFolder(), "modules");
|
File f = new File(this.getDataFolder(), "modules");
|
||||||
if(f.exists() && f.isDirectory()){
|
if (f.exists() && f.isDirectory()) {
|
||||||
|
|
||||||
File[] modules = f.listFiles();
|
File[] modules = f.listFiles();
|
||||||
for(File module : modules){
|
for (File module : modules) {
|
||||||
|
|
||||||
loadModule(module);
|
loadModule(module);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
f.mkdir();
|
f.mkdir();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadModule(File jar){
|
public void loadModule(File jar) {
|
||||||
|
|
||||||
try{
|
try {
|
||||||
|
|
||||||
JarFile jarFile = new JarFile(jar);
|
JarFile jarFile = new JarFile(jar);
|
||||||
Enumeration e = jarFile.entries();
|
Enumeration e = jarFile.entries();
|
||||||
|
|
||||||
URL[] urls = { new URL("jar:file:" + jar.getPath() + "!/") };
|
URL[] urls = {new URL("jar:file:" + jar.getPath() + "!/")};
|
||||||
|
|
||||||
ClassLoader cl = URLClassLoader.newInstance(urls, getClassLoader());
|
ClassLoader cl = URLClassLoader.newInstance(urls, getClassLoader());
|
||||||
|
|
||||||
while (e.hasMoreElements()) {
|
while (e.hasMoreElements()) {
|
||||||
|
|
||||||
JarEntry je = (JarEntry) e.nextElement();
|
JarEntry je = (JarEntry) e.nextElement();
|
||||||
if(je.isDirectory() || !je.getName().endsWith(".class")){
|
if (je.isDirectory() || !je.getName().endsWith(".class")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String className = je.getName().substring(0,je.getName().length()-6);
|
String className = je.getName().substring(0, je.getName().length() - 6);
|
||||||
className = className.replace('/', '.');
|
className = className.replace('/', '.');
|
||||||
Class<?> c = Class.forName(className, true, cl);
|
Class<?> c = Class.forName(className, true, cl);
|
||||||
Class<? extends CustomRequirement> requirementClass = c.asSubclass(CustomRequirement.class);
|
Class<? extends CustomRequirement> requirementClass = c.asSubclass(CustomRequirement.class);
|
||||||
@ -479,15 +479,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
String author = requirement.getAuthor() == null ? "[Unknown]" : requirement.getAuthor();
|
String author = requirement.getAuthor() == null ? "[Unknown]" : requirement.getAuthor();
|
||||||
printInfo("[Quests] Loaded Module: " + name + " by " + author);
|
printInfo("[Quests] Loaded Module: " + name + " by " + author);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
printSevere("[Quests] Error: Unable to load module from file: " + jar.getName());
|
printSevere("[Quests] Error: Unable to load module from file: " + jar.getName());
|
||||||
if(debug){
|
if (debug) {
|
||||||
printSevere("[Quests] Error log:");
|
printSevere("[Quests] Error log:");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printHelp(Player player) {
|
public void printHelp(Player player) {
|
||||||
@ -640,21 +640,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(quest.heroesPrimaryClassReq != null){
|
if (quest.heroesPrimaryClassReq != null) {
|
||||||
|
|
||||||
if(this.testPrimaryHeroesClass(quest.heroesPrimaryClassReq, player.getName())){
|
if (this.testPrimaryHeroesClass(quest.heroesPrimaryClassReq, player.getName())) {
|
||||||
cs.sendMessage(BOLD + "" + GREEN + quest.heroesPrimaryClassReq + RESET + "" + DARKGREEN + " class");
|
cs.sendMessage(BOLD + "" + GREEN + quest.heroesPrimaryClassReq + RESET + "" + DARKGREEN + " class");
|
||||||
}else{
|
} else {
|
||||||
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesPrimaryClassReq + RESET + "" + RED + " class");
|
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesPrimaryClassReq + RESET + "" + RED + " class");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(quest.heroesSecondaryClassReq != null){
|
if (quest.heroesSecondaryClassReq != null) {
|
||||||
|
|
||||||
if(this.testSecondaryHeroesClass(quest.heroesSecondaryClassReq, player.getName())){
|
if (this.testSecondaryHeroesClass(quest.heroesSecondaryClassReq, player.getName())) {
|
||||||
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesSecondaryClassReq + RESET + "" + RED + " class");
|
cs.sendMessage(BOLD + "" + DARKRED + quest.heroesSecondaryClassReq + RESET + "" + RED + " class");
|
||||||
}else{
|
} else {
|
||||||
cs.sendMessage(BOLD + "" + GREEN + quest.heroesSecondaryClassReq + RESET + "" + DARKGREEN + " class");
|
cs.sendMessage(BOLD + "" + GREEN + quest.heroesSecondaryClassReq + RESET + "" + DARKGREEN + " class");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -919,21 +919,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(quest.region != null){
|
if (quest.region != null) {
|
||||||
|
|
||||||
boolean inRegion = false;
|
boolean inRegion = false;
|
||||||
Player p = quester.getPlayer();
|
Player p = quester.getPlayer();
|
||||||
RegionManager rm = worldGuard.getRegionManager(p.getWorld());
|
RegionManager rm = worldGuard.getRegionManager(p.getWorld());
|
||||||
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
Iterator<ProtectedRegion> it = rm.getApplicableRegions(p.getLocation()).iterator();
|
||||||
while(it.hasNext()){
|
while (it.hasNext()) {
|
||||||
ProtectedRegion pr = it.next();
|
ProtectedRegion pr = it.next();
|
||||||
if(pr.getId().equalsIgnoreCase(quest.region)){
|
if (pr.getId().equalsIgnoreCase(quest.region)) {
|
||||||
inRegion = true;
|
inRegion = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inRegion == false){
|
if (inRegion == false) {
|
||||||
cs.sendMessage(YELLOW + "You may not take " + AQUA + quest.name + YELLOW + " at this location.");
|
cs.sendMessage(YELLOW + "You may not take " + AQUA + quest.name + YELLOW + " at this location.");
|
||||||
takeable = false;
|
takeable = false;
|
||||||
}
|
}
|
||||||
@ -1053,11 +1053,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
for (String s : quester.completedQuests) {
|
for (String s : quester.completedQuests) {
|
||||||
|
|
||||||
completed += s;
|
completed += s;
|
||||||
|
|
||||||
if (quester.amountsCompleted.containsKey(s) && quester.amountsCompleted.get(s) > 1){
|
if (quester.amountsCompleted.containsKey(s) && quester.amountsCompleted.get(s) > 1) {
|
||||||
completed += PINK + " (x" + quester.amountsCompleted.get(s) + ")";
|
completed += PINK + " (x" + quester.amountsCompleted.get(s) + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (quester.completedQuests.indexOf(s) < (quester.completedQuests.size() - 1)) {
|
if (quester.completedQuests.indexOf(s) < (quester.completedQuests.size() - 1)) {
|
||||||
completed += ", ";
|
completed += ", ";
|
||||||
}
|
}
|
||||||
@ -1307,73 +1307,73 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
} else if (args[0].equalsIgnoreCase("setstage")) {
|
} else if (args[0].equalsIgnoreCase("setstage")) {
|
||||||
|
|
||||||
if (cs.hasPermission("quests.admin.setstage")) {
|
if (cs.hasPermission("quests.admin.setstage")) {
|
||||||
|
|
||||||
Player target = null;
|
Player target = null;
|
||||||
|
|
||||||
for (Player p : getServer().getOnlinePlayers()) {
|
for (Player p : getServer().getOnlinePlayers()) {
|
||||||
|
|
||||||
//To ensure the correct player is selected
|
//To ensure the correct player is selected
|
||||||
if (p.getName().equalsIgnoreCase(args[1])) {
|
if (p.getName().equalsIgnoreCase(args[1])) {
|
||||||
target = p;
|
target = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
//
|
//
|
||||||
for (Player p : getServer().getOnlinePlayers()) {
|
for (Player p : getServer().getOnlinePlayers()) {
|
||||||
|
|
||||||
if (p.getName().toLowerCase().contains(args[1].toLowerCase())) {
|
if (p.getName().toLowerCase().contains(args[1].toLowerCase())) {
|
||||||
target = p;
|
target = p;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int stage = -1;
|
int stage = -1;
|
||||||
if (args.length > 2) {
|
if (args.length > 2) {
|
||||||
try {
|
try {
|
||||||
stage = Integer.parseInt(args[2]);
|
stage = Integer.parseInt(args[2]);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
cs.sendMessage(YELLOW + "Invalid number");
|
cs.sendMessage(YELLOW + "Invalid number");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cs.sendMessage(YELLOW + "Enter a stage");
|
cs.sendMessage(YELLOW + "Enter a stage");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == null) {
|
if (target == null) {
|
||||||
|
|
||||||
cs.sendMessage(YELLOW + "Player not found.");
|
cs.sendMessage(YELLOW + "Player not found.");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Quester quester = getQuester(target.getName());
|
Quester quester = getQuester(target.getName());
|
||||||
if (quester.currentQuest == null) {
|
if (quester.currentQuest == null) {
|
||||||
|
|
||||||
cs.sendMessage(YELLOW + target.getName() + " does not currently have an active Quest.");
|
cs.sendMessage(YELLOW + target.getName() + " does not currently have an active Quest.");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
quester.currentQuest.setStage(quester, stage);
|
quester.currentQuest.setStage(quester, stage);
|
||||||
} catch (InvalidStageException e) {
|
} catch (InvalidStageException e) {
|
||||||
cs.sendMessage(ChatColor.RED + "Advancing " + target.getName() + " to Stage: " + stage + ", has failed.");
|
cs.sendMessage(ChatColor.RED + "Advancing " + target.getName() + " to Stage: " + stage + ", has failed.");
|
||||||
cs.sendMessage(ChatColor.RED + "Not enough stages.");
|
cs.sendMessage(ChatColor.RED + "Not enough stages.");
|
||||||
}
|
}
|
||||||
|
|
||||||
quester.saveData();
|
quester.saveData();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
cs.sendMessage(RED + "You do not have access to that command.");
|
cs.sendMessage(RED + "You do not have access to that command.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (args[0].equalsIgnoreCase("finish")) {
|
} else if (args[0].equalsIgnoreCase("finish")) {
|
||||||
|
|
||||||
@ -1504,15 +1504,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (args[0].equalsIgnoreCase("give")) {
|
||||||
|
|
||||||
cs.sendMessage(YELLOW + "Unknown Questadmin command. Type /questadmin for help.");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("give")) {
|
|
||||||
|
|
||||||
if (cs.hasPermission("quests.admin.give")) {
|
if (cs.hasPermission("quests.admin.give")) {
|
||||||
|
|
||||||
@ -1925,14 +1917,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ConfigurationSection section1;
|
ConfigurationSection section1;
|
||||||
if(config.contains("quests"))
|
if (config.contains("quests")) {
|
||||||
section1 = config.getConfigurationSection("quests");
|
section1 = config.getConfigurationSection("quests");
|
||||||
else{
|
} else {
|
||||||
section1 = config.createSection("quests");
|
section1 = config.createSection("quests");
|
||||||
needsSaving = true;
|
needsSaving = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (String s : section1.getKeys(false)) {
|
for (String s : section1.getKeys(false)) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -1974,16 +1965,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".region")){
|
if (config.contains("quests." + s + ".region")) {
|
||||||
|
|
||||||
String region = config.getString("quests." + s + ".region");
|
String region = config.getString("quests." + s + ".region");
|
||||||
boolean exists = false;
|
boolean exists = false;
|
||||||
for(World world : getServer().getWorlds()){
|
for (World world : getServer().getWorlds()) {
|
||||||
|
|
||||||
RegionManager rm = worldGuard.getRegionManager(world);
|
RegionManager rm = worldGuard.getRegionManager(world);
|
||||||
if(rm != null){
|
if (rm != null) {
|
||||||
ProtectedRegion pr = rm.getRegionExact(region);
|
ProtectedRegion pr = rm.getRegionExact(region);
|
||||||
if(pr != null){
|
if (pr != null) {
|
||||||
quest.region = region;
|
quest.region = region;
|
||||||
exists = true;
|
exists = true;
|
||||||
break;
|
break;
|
||||||
@ -1992,7 +1983,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!exists){
|
if (!exists) {
|
||||||
printSevere("[Quests] region: for Quest " + quest.name + " is not a valid WorldGuard region!");
|
printSevere("[Quests] region: for Quest " + quest.name + " is not a valid WorldGuard region!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2249,12 +2240,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
String className = config.getString("quests." + s + ".requirements.heroes-primary-class");
|
String className = config.getString("quests." + s + ".requirements.heroes-primary-class");
|
||||||
HeroClass hc = heroes.getClassManager().getClass(className);
|
HeroClass hc = heroes.getClassManager().getClass(className);
|
||||||
if(hc != null && hc.isPrimary()){
|
if (hc != null && hc.isPrimary()) {
|
||||||
quest.heroesPrimaryClassReq = hc.getName();
|
quest.heroesPrimaryClassReq = hc.getName();
|
||||||
}else if(hc != null){
|
} else if (hc != null) {
|
||||||
printSevere("[Quests] heroes-primary-class: Requirement for Quest " + quest.name + " is not a primary Heroes class!");
|
printSevere("[Quests] heroes-primary-class: Requirement for Quest " + quest.name + " is not a primary Heroes class!");
|
||||||
continue;
|
continue;
|
||||||
}else{
|
} else {
|
||||||
printSevere("[Quests] heroes-primary-class: Requirement for Quest " + quest.name + " is not a valid Heroes class!");
|
printSevere("[Quests] heroes-primary-class: Requirement for Quest " + quest.name + " is not a valid Heroes class!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2265,50 +2256,50 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
String className = config.getString("quests." + s + ".requirements.heroes-secondary-class");
|
String className = config.getString("quests." + s + ".requirements.heroes-secondary-class");
|
||||||
HeroClass hc = heroes.getClassManager().getClass(className);
|
HeroClass hc = heroes.getClassManager().getClass(className);
|
||||||
if(hc != null && hc.isSecondary()){
|
if (hc != null && hc.isSecondary()) {
|
||||||
quest.heroesSecondaryClassReq = hc.getName();
|
quest.heroesSecondaryClassReq = hc.getName();
|
||||||
}else if(hc != null){
|
} else if (hc != null) {
|
||||||
printSevere("[Quests] heroes-secondary-class: Requirement for Quest " + quest.name + " is not a secondary Heroes class!");
|
printSevere("[Quests] heroes-secondary-class: Requirement for Quest " + quest.name + " is not a secondary Heroes class!");
|
||||||
continue;
|
continue;
|
||||||
}else{
|
} else {
|
||||||
printSevere("[Quests] heroes-secondary-class: Requirement for Quest " + quest.name + " is not a valid Heroes class!");
|
printSevere("[Quests] heroes-secondary-class: Requirement for Quest " + quest.name + " is not a valid Heroes class!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".requirements.custom-requirements")) {
|
if (config.contains("quests." + s + ".requirements.custom-requirements")) {
|
||||||
|
|
||||||
ConfigurationSection sec = config.getConfigurationSection("quests." + s + ".requirements.custom-requirements");
|
ConfigurationSection sec = config.getConfigurationSection("quests." + s + ".requirements.custom-requirements");
|
||||||
for(String path : sec.getKeys(false)){
|
for (String path : sec.getKeys(false)) {
|
||||||
|
|
||||||
String name = sec.getString(path + ".name");
|
String name = sec.getString(path + ".name");
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
||||||
for(CustomRequirement cr : customRequirements){
|
for (CustomRequirement cr : customRequirements) {
|
||||||
if(cr.getName().equalsIgnoreCase(name)){
|
if (cr.getName().equalsIgnoreCase(name)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found){
|
if (!found) {
|
||||||
printWarning("[Quests] Custom requirement \"" + name + "\" for Quest \"" + quest.name + "\" could not be found!");
|
printWarning("[Quests] Custom requirement \"" + name + "\" for Quest \"" + quest.name + "\" could not be found!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<String, Object>();
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
ConfigurationSection sec2 = sec.getConfigurationSection(path + ".data");
|
ConfigurationSection sec2 = sec.getConfigurationSection(path + ".data");
|
||||||
if(sec2 != null){
|
if (sec2 != null) {
|
||||||
for(String dataPath : sec2.getKeys(false)){
|
for (String dataPath : sec2.getKeys(false)) {
|
||||||
data.put(dataPath, sec2.get(dataPath));
|
data.put(dataPath, sec2.get(dataPath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quest.customRequirements.put(name, data);
|
quest.customRequirements.put(name, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3575,7 +3566,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.mcmmo-levels")) {
|
if (config.contains("quests." + s + ".rewards.mcmmo-levels")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-levels"), Integer.class)){
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-levels"), Integer.class)) {
|
||||||
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
for (String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")) {
|
for (String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")) {
|
||||||
@ -4458,14 +4449,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
public Quest findQuest(String s) {
|
public Quest findQuest(String s) {
|
||||||
|
|
||||||
for(Quest q : quests) {
|
for (Quest q : quests) {
|
||||||
if(q.name.equalsIgnoreCase(s))
|
if (q.name.equalsIgnoreCase(s)) {
|
||||||
return q;
|
return q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Quest q : quests) {
|
for (Quest q : quests) {
|
||||||
if(q.name.toLowerCase().contains(s.toLowerCase()))
|
if (q.name.toLowerCase().contains(s.toLowerCase())) {
|
||||||
return q;
|
return q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -4819,20 +4812,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void snoop() {
|
public void snoop() {
|
||||||
|
|
||||||
String ip = getServer().getIp().trim();
|
String ip = getServer().getIp().trim();
|
||||||
if (ip.isEmpty() || ip.startsWith("192") || ip.startsWith("localhost") || ip.startsWith("127") || ip.startsWith("0.0"))
|
if (ip.isEmpty() || ip.startsWith("192") || ip.startsWith("localhost") || ip.startsWith("127") || ip.startsWith("0.0")) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
snoop_delete();
|
snoop_delete();
|
||||||
snoop_insert();
|
snoop_insert();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void snoop_insert() {
|
private void snoop_insert() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Date date = new Date(System.currentTimeMillis());
|
Date date = new Date(System.currentTimeMillis());
|
||||||
Timestamp stamp = new Timestamp(date.getTime());
|
Timestamp stamp = new Timestamp(date.getTime());
|
||||||
String arguments = "arg1=" + getServer().getIp()
|
String arguments = "arg1=" + getServer().getIp()
|
||||||
@ -4850,21 +4844,22 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
String inputLine;
|
String inputLine;
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
||||||
if(inputLine.equalsIgnoreCase("false"))
|
if (inputLine.equalsIgnoreCase("false")) {
|
||||||
printWarning("[Quests] An error occurred inserting data into the snooper database!");
|
printWarning("[Quests] An error occurred inserting data into the snooper database!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
printWarning("[Quests] An error occurred inserting data into the snooper database!");
|
printWarning("[Quests] An error occurred inserting data into the snooper database!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void snoop_delete() {
|
private void snoop_delete() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
String arguments = "arg1=" + getServer().getIp() + "&arg2=" + ((Integer) getServer().getPort()).toString();
|
String arguments = "arg1=" + getServer().getIp() + "&arg2=" + ((Integer) getServer().getPort()).toString();
|
||||||
URL url = new URL("http://www.blackvein.net/php/quests_del.php?" + arguments);
|
URL url = new URL("http://www.blackvein.net/php/quests_del.php?" + arguments);
|
||||||
URLConnection yc = url.openConnection();
|
URLConnection yc = url.openConnection();
|
||||||
@ -4874,15 +4869,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
String inputLine;
|
String inputLine;
|
||||||
|
|
||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
||||||
if(inputLine.equalsIgnoreCase("false"))
|
if (inputLine.equalsIgnoreCase("false")) {
|
||||||
printWarning("[Quests] An error occurred removing old data from the snooper database!");
|
printWarning("[Quests] An error occurred removing old data from the snooper database!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
printWarning("[Quests] An error occurred removing old data from the snooper database!");
|
printWarning("[Quests] An error occurred removing old data from the snooper database!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasQuest(NPC npc, Quester quester) {
|
public boolean hasQuest(NPC npc, Quester quester) {
|
||||||
@ -4901,7 +4897,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMCMMOSkillLevel(SkillType st, String player) {
|
public static int getMCMMOSkillLevel(SkillType st, String player) {
|
||||||
|
|
||||||
McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mPlayer = UserManager.getPlayer(player);
|
||||||
@ -4913,24 +4909,25 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Hero getHero(String player){
|
public Hero getHero(String player) {
|
||||||
|
|
||||||
Player p = getServer().getPlayer(player);
|
Player p = getServer().getPlayer(player);
|
||||||
if(p == null)
|
if (p == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return heroes.getCharacterManager().getHero(p);
|
return heroes.getCharacterManager().getHero(p);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean testPrimaryHeroesClass(String primaryClass, String player){
|
public boolean testPrimaryHeroesClass(String primaryClass, String player) {
|
||||||
|
|
||||||
Hero hero = getHero(player);
|
Hero hero = getHero(player);
|
||||||
return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass);
|
return hero.getHeroClass().getName().equalsIgnoreCase(primaryClass);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean testSecondaryHeroesClass(String secondaryClass, String player){
|
public boolean testSecondaryHeroesClass(String secondaryClass, String player) {
|
||||||
|
|
||||||
Hero hero = getHero(player);
|
Hero hero = getHero(player);
|
||||||
return hero.getHeroClass().getName().equalsIgnoreCase(secondaryClass);
|
return hero.getHeroClass().getName().equalsIgnoreCase(secondaryClass);
|
||||||
|
@ -246,6 +246,7 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
cc.setSessionData("tempId", mat.getId());
|
cc.setSessionData("tempId", mat.getId());
|
||||||
|
cc.setSessionData("tempAmount", 1);
|
||||||
|
|
||||||
if (dataString != null) {
|
if (dataString != null) {
|
||||||
try {
|
try {
|
||||||
@ -415,11 +416,13 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
|||||||
|
|
||||||
Map<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
Map<Enchantment, Integer> enchs = (Map<Enchantment, Integer>) cc.getSessionData("tempEnchantments");
|
||||||
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
||||||
|
cc.setSessionData("tempEnchantments", enchs);
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
Map<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
Map<Enchantment, Integer> enchs = new HashMap<Enchantment, Integer>();
|
||||||
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
enchs.put((Enchantment)cc.getSessionData("tempEnchant"), num);
|
||||||
|
cc.setSessionData("tempEnchantments", enchs);
|
||||||
|
|
||||||
}
|
}
|
||||||
return new ItemStackPrompt(oldPrompt);
|
return new ItemStackPrompt(oldPrompt);
|
||||||
|
Loading…
Reference in New Issue
Block a user