+Added quests that block other quests.

This commit is contained in:
Zino 2013-07-31 09:50:11 +02:00
parent 7a31db24d8
commit ec5bbcb44a
5 changed files with 292 additions and 3 deletions

215
items.txt Normal file
View File

@ -0,0 +1,215 @@
Stone=1
Grass=2
Dirt=3
Cobblestone,Cobble=4
WoodenPlank=5,0
RedwoodPlank=5,1
BirchPlank=5,2
Sapling=6
Bedrock=7
Water=8
StationaryWater=9
Lava=10
StationaryLava=11
Sand=12
Gravel=13
GoldOre=14
IronOre=15
CoalOre=16
Wood=17
Leaves=18,0
RedwoodLeaves=18,1
BirchLeaves=18,2
Sponge=19
Glass=20
LapisLazuliOre=21
LapisLazuliBlock=22
Dispenser=23
Sandstone=24
NoteBlock=25
Wool=35,0
OrangeWool=35,1
MagentaWool=35,2
LightBlueWool=35,3
YellowWool=35,4
LightGreenWool=35,5
PinkWool=35,6
GrayWool=35,7
LightGrayWool=35,8
CyanWool=35,9
PurpleWool=35,10
BlueWool=35,11
BrownWool=35,12
DarkGreenWool=35,13
RedWool=35,14
BlackWool=35,15
YellowFlower=37
RedRose=38
BrownMushroom=39
RedMushroom=40
GoldBlock=41
IronBlock=42
DoubleSlab=43
StoneSlab=44,0
SandstoneSlab=44,1
WoodenSlab=44,2
CobblestoneSlab=44,3
BrickBlock=45
TNT=46
Bookshelf=47
MossStone=48
Obsidian=49
Torch=50
MonsterSpawner=52
WoodenStairs=53
Chest=54
DiamondOre=56
DiamondBlock=57
CraftingTable=58
Crops=59
Farmland=60
Furnace=61
Ladder=65
Rails=66
CobblestoneStairs=67
Lever=69
StonePressurePlate=70
WoodenPressurePlate=72
RedstoneOre=73
GlowingRedstoneOre=74
RedstoneTorch=76
StoneButton=77
Snow=78
Ice=79
SnowBlock=80
Cactus=81
ClayBlock=82
Jukebox=84
Fence=85
Pumpkin=86
Netherrack=87
SoulSand=88
GlowstoneBlock=89
Portal=90
Jack-O-Lantern=91
CakeBlock=92
IronShovel=256
IronPickaxe=257
IronAxe=258
FlintandSteel=259
Apple=260
Bow=261
Arrow=262
Coal=263,0
Charcoal=263,1
Diamond=264
IronIngot=265
GoldIngot=266
IronSword=267
WoodenSword=268
WoodenShovel=269
WoodenPickaxe=270
WoodenAxe=271
StoneSword=272
StoneShovel=273
StonePickaxe=274
StoneAxe=275
DiamondSword=276
DiamondShovel=277
DiamondPickaxe=278
DiamondAxe=279
Stick=280
Bowl=281
MushroomSoup=282
GoldSword=283
GoldShovel=284
GoldPickaxe=285
GoldAxe=286
String=287
Feather=288
Gunpowder=289
WoodenHoe=290
StoneHoe=291
IronHoe=292
DiamondHoe=293
GoldHoe=294
Seeds=295
Wheat=296
Bread=297
LeatherHelmet=298
LeatherChestplate=299
LeatherLeggings=300
LeatherBoots=301
ChainmailHelmet=302
ChainmailChestplate=303
ChainmailLeggings=304
ChainmailBoots=305
IronHelmet=306
IronChestplate=307
IronLeggings=308
IronBoots=309
DiamondHelmet=310
DiamondChestplate=311
DiamondLeggings=312
DiamondBoots=313
GoldHelmet=314
GoldChestplate=315
GoldLeggings=316
GoldBoots=317
Flint=318
RawPorkchop=319
CookedPorkchop=320
Paintings=321
Goldenapple=322
Sign=323
Woodendoor=324
Bucket=325
Waterbucket=326
Lavabucket=327
Minecart=328
Saddle=329
Irondoor=330
Redstone=331
Snowball=332
Boat=333
Leather=334
Milk=335
ClayBrick=336
ClayBalls=337
SugarCane=338
Paper=339
Book=340
Slimeball=341
StorageMinecart=342
PoweredMinecart=343
Egg=344
Compass=345
FishingRod=346
Clock=347
GlowstoneDust=348
RawFish=349
CookedFish=350
InkSac=351,0
RoseRed=351,1
CactusGreen=351,2
CocoaBeans=351,3
LapisLazuliDye=351,4
PurpleDye=351,5
CyanDye=351,6
LightGrayDye=351,7
GrayDye=351,8
PinkDye=351,9
LimeDye=351,10
DandelionYellow=351,11
LightBlueDye=351,12
MagentaDye=351,13
OrangeDye=351,14
BoneMeal=351,15
Bone=352
Sugar=353
Cake=354
Bed=355
RedstoneRepeater=356
Cookie=357
GoldMusicDisc=2256
GreenMusicDisc=2257

View File

@ -1,5 +1,6 @@
package me.blackvein.quests;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import me.blackvein.quests.util.ItemUtil;
@ -10,6 +11,7 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import com.comphenix.net.sf.cglib.core.CollectionUtils;
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
public class Quest {
@ -33,6 +35,7 @@ public class Quest {
List<Boolean> removeItems = new LinkedList<Boolean>();
List<String> neededQuests = new LinkedList<String>();
List<String> blockQuests = new LinkedList<String>();
List<String> permissionReqs = new LinkedList<String>();
@ -147,6 +150,12 @@ public class Quest {
if(quester.completedQuests.containsAll(neededQuests) == false)
return false;
for (String q : blockQuests) {
if (quester.completedQuests.contains(q)) {
return false;
}
}
return true;
}
@ -319,6 +328,9 @@ public class Quest {
if(other.neededQuests.equals(neededQuests) == false)
return false;
if (other.blockQuests.equals(blockQuests) == false)
return false;
if(other.npcStart != null && npcStart != null){
if(other.npcStart.equals(npcStart) == false)
return false;

View File

@ -1306,6 +1306,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
cc.setSessionData("questReqs", q.neededQuests);
}
if (q.blockQuests.isEmpty() == false) {
cc.setSessionData("questBlocks", q.blockQuests);
}
if (q.permissionReqs.isEmpty() == false) {
cc.setSessionData("permissionReqs", q.permissionReqs);
}
@ -1650,7 +1654,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
for (Quest q : quests.quests) {
if (q.neededQuests.contains(q.name)) {
if (q.neededQuests.contains(q.name) || q.blockQuests.contains(q.name)) {
used.add(q.name);
}

View File

@ -573,6 +573,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (quest.blockQuests.isEmpty() == false) {
for (String s : quest.blockQuests) {
if (quester.completedQuests.contains(s)) {
cs.sendMessage(GRAY + "- " + RED + "You have already Completed " + ITALIC + s);
} else {
cs.sendMessage(GRAY + "- " + GREEN + "Still able to complete " + ITALIC + s);
}
}
}
}
} else {
@ -2018,6 +2032,49 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (config.contains("quests." + s + ".requirements.noQuests")) {
if (Quests.checkList(config.getList("quests." + s + ".requirements.noQuests"), String.class)) {
List<String> names = config.getStringList("quests." + s + ".requirements.noQuests");
boolean failed = false;
String failedQuest = "NULL";
for (String name : names) {
boolean done = false;
for (String string : section1.getKeys(false)) {
if (config.getString("quests." + string + ".name").equalsIgnoreCase(name)) {
quest.blockQuests.add(name);
done = true;
break;
}
}
if (!done) {
failed = true;
failedQuest = name;
break;
}
}
if (failed) {
printSevere(GOLD + "[Quests] " + PINK + failedQuest + GOLD + " inside " + RED + "quests: " + YELLOW + "Requirement " + GOLD + "for Quest " + PURPLE + quest.name + GOLD + " is not a valid Quest name!");
printSevere(RED + "Make sure you are using the Quest " + DARKRED + "name: " + RED + "value, and not the block name.");
continue;
}
} else {
printSevere(GOLD + "[Quests] " + RED + "quests: " + YELLOW + "Requirement " + GOLD + "for Quest " + PURPLE + quest.name + GOLD + " is not a list of Quest names!");
continue;
}
}
if (config.contains("quests." + s + ".requirements.quests")) {
if (Quests.checkList(config.getList("quests." + s + ".requirements.quests"), String.class)) {
@ -2061,6 +2118,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
}
if (config.contains("quests." + s + ".requirements.permissions")) {
if (Quests.checkList(config.getList("quests." + s + ".requirements.permissions"), String.class)) {
@ -3450,6 +3508,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
parsed = parsed.replaceAll("<underline>", UNDERLINE.toString());
parsed = parsed.replaceAll("<strike>", STRIKETHROUGH.toString());
parsed = parsed.replaceAll("<reset>", RESET.toString());
parsed = ChatColor.translateAlternateColorCodes('&', parsed);
return parsed;

View File

@ -242,7 +242,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
}catch(Exception e){
try {
Data data = ItemData.getInstance().getItem(input);
Bukkit.broadcastMessage(input + ":" + data);
if (data == null) {
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
return new IDPrompt();