mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
commit
20e35b389b
215
items.txt
Normal file
215
items.txt
Normal 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
|
33
pom.xml
33
pom.xml
@ -3,7 +3,7 @@
|
||||
|
||||
<groupId>me.blackvein.quests</groupId>
|
||||
<artifactId>quests</artifactId>
|
||||
<version>1.5.2-SNAPSHOT</version>
|
||||
<version>1.6.2-SNAPSHOT</version>
|
||||
<name>quests</name>
|
||||
<url>http://dev.bukkit.org/server-mods/quests/</url>
|
||||
<packaging>jar</packaging>
|
||||
@ -14,39 +14,48 @@
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<repository>
|
||||
<id>bukkit-repo</id>
|
||||
<url>http://repo.bukkit.org/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>citizensapi-repo</id>
|
||||
<url>http://ci.citizensnpcs.com/plugin/repository/everything</url>
|
||||
<id>citizens-repo</id>
|
||||
<url>http://repo.citizensnpcs.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>denizens-repo</id>
|
||||
<url>http://ci.citizensnpcs.com/view/Characters/job/Denizen/592/maven-repository/repository/</url>
|
||||
<url>http://repo.citizensnpcs.com</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mcMMO-repo</id>
|
||||
<url>http://repo.mcmmo.org</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.4.2-R0.2</version>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.citizensnpcs</groupId>
|
||||
<artifactId>citizensapi</artifactId>
|
||||
<version>2.0.4-SNAPSHOT</version>
|
||||
<artifactId>citizens</artifactId>
|
||||
<version>2.0.9-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.aufdemrand</groupId>
|
||||
<artifactId>denizen</artifactId>
|
||||
<version>0.76-SNAPSHOT</version>
|
||||
<version>0.8-PRERELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
@ -56,7 +65,7 @@
|
||||
<dependency>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>1.3.11</version>
|
||||
<version>LATEST</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -94,4 +103,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
215
src/items.txt
Normal file
215
src/items.txt
Normal 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
|
@ -10,6 +10,8 @@ import java.util.Map.Entry;
|
||||
import me.blackvein.quests.prompts.ItemStackPrompt;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
@ -1156,8 +1158,8 @@ public class EventFactory implements ConversationAbandonedListener, ColorUtil{
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||
|
||||
if (input.intValue() != -1) {
|
||||
|
||||
if (quests.citizens.getNPCRegistry().getById(input.intValue()) == null) {
|
||||
|
||||
if (CitizensAPI.getNPCRegistry().getById(input.intValue()) == null) {
|
||||
context.getForWhom().sendRawMessage(RED + Lang.get("eventEditorNoNPCExists"));
|
||||
return new SetNpcStartPrompt();
|
||||
}
|
||||
|
75
src/me/blackvein/quests/ItemData.java
Normal file
75
src/me/blackvein/quests/ItemData.java
Normal file
@ -0,0 +1,75 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class ItemData {
|
||||
|
||||
public HashMap<String, Data> map = new HashMap<String, Data>();
|
||||
private static ItemData instance = null;
|
||||
|
||||
public static ItemData getInstance() {
|
||||
if (instance != null) {
|
||||
return instance;
|
||||
} else {
|
||||
instance = new ItemData();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemData() {
|
||||
Scanner scanner = new Scanner(this.getClass().getClassLoader().getResourceAsStream("items.txt"));
|
||||
|
||||
while(scanner.hasNextLine()) {
|
||||
String[] line = scanner.nextLine().split("=");
|
||||
if (line.length > 1) {
|
||||
String[] name = line[0].split(",");
|
||||
Data data;
|
||||
|
||||
String[] str = line[1].split(",");
|
||||
|
||||
int id = -1;
|
||||
byte mdata = 0;
|
||||
try {
|
||||
id = Integer.parseInt(str[0]);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (str.length > 1) {
|
||||
mdata = Byte.parseByte(str[1]);
|
||||
}
|
||||
|
||||
for (String n : name) {
|
||||
data = new Data(n, id, mdata);
|
||||
map.put(n, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public Data getItem(String input) {
|
||||
if (map.containsKey(input)) {
|
||||
return map.get(input);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public class Data {
|
||||
private String name_;
|
||||
private int id_;
|
||||
private byte data_;
|
||||
|
||||
public Data(String name, int id, byte mdata) {
|
||||
this.name_ = name;
|
||||
this.id_ = id;
|
||||
this.data_ = mdata;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id_;
|
||||
}
|
||||
|
||||
public byte getData() {
|
||||
return data_;
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package me.blackvein.quests;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.LinkedList;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.event.NPCDeathEvent;
|
||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -171,7 +172,7 @@ public class NpcListener implements Listener {
|
||||
boolean okay = true;
|
||||
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(player)) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player)) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
|
@ -18,8 +18,9 @@
|
||||
*/
|
||||
package me.blackvein.quests;
|
||||
|
||||
import net.minecraft.server.v1_5_R3.Packet;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
||||
import net.minecraft.server.v1_6_R2.Packet;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PacketUtils {
|
||||
|
@ -1,9 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import me.blackvein.quests.util.ReflectionUtil;
|
||||
import net.minecraft.server.v1_5_R3.Packet63WorldParticles;
|
||||
import net.minecraft.server.v1_6_R2.Packet63WorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum ParticleEffect {
|
||||
|
@ -1,6 +1,10 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.conversations.Conversation;
|
||||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
||||
import org.bukkit.conversations.ConversationAbandonedListener;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
@ -134,9 +138,15 @@ public class Party implements ConversationAbandonedListener, ColorUtil{
|
||||
|
||||
public void sendInvite(Quester target){
|
||||
|
||||
//Temporary.
|
||||
if (factory == null) {
|
||||
this.initFactory();
|
||||
}
|
||||
|
||||
Player player = target.getPlayer();
|
||||
|
||||
|
||||
Conversation conversation = factory.buildConversation((Conversable)player);
|
||||
conversation.getContext().setSessionData("inviter", getLeader().getPlayer().getName());
|
||||
conversation.begin();
|
||||
}
|
||||
|
||||
public void checkSize(){
|
||||
@ -160,8 +170,10 @@ public class Party implements ConversationAbandonedListener, ColorUtil{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void conversationAbandoned(ConversationAbandonedEvent cae) {
|
||||
throw new UnsupportedOperationException("Not supported yet.");a
|
||||
public void conversationAbandoned(ConversationAbandonedEvent event) {
|
||||
//TODO: support this.
|
||||
//Player player = (Player) event.getContext().getForWhom();
|
||||
//throw new UnsupportedOperationException("Not supported yet.");
|
||||
}
|
||||
|
||||
private static class PartyPrefix implements ConversationPrefix {
|
||||
@ -189,24 +201,33 @@ public class Party implements ConversationAbandonedListener, ColorUtil{
|
||||
@Override
|
||||
public Prompt acceptInput(ConversationContext context, String s) {
|
||||
|
||||
Player player = (Player) context.getForWhom();
|
||||
Player invited = (Player) context.getForWhom();
|
||||
|
||||
if (s.equalsIgnoreCase("Yes")) {
|
||||
|
||||
String inviterName = (String) context.getSessionData("inviter");
|
||||
|
||||
Quester quester =
|
||||
Quester quester = quests.getQuester(invited.getName());
|
||||
members.add(quester);
|
||||
|
||||
//send message to inviter and invited
|
||||
quester.getPlayer().sendMessage(partyPrefix + YELLOW + "Accepted invite.");
|
||||
Bukkit.getPlayerExact(inviterName).sendMessage(partyPrefix + GREEN + invited.getName() + YELLOW + " has accepted your invitation.");
|
||||
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
} else if (s.equalsIgnoreCase("No")) {
|
||||
|
||||
String inviterName = (String) context.getSessionData("inviter");
|
||||
|
||||
player.sendMessage(partyPrefix + YELLOW + "Declined invite.");
|
||||
invited.sendMessage(partyPrefix + YELLOW + "Declined invite.");
|
||||
Bukkit.getPlayerExact(inviterName).sendMessage(partyPrefix + GREEN + invited.getName() + YELLOW + " has declined your invitation.");
|
||||
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
} else {
|
||||
|
||||
player.sendMessage(RED + "Invalid choice. Type \'Yes\' or \'No\'");
|
||||
invited.sendMessage(RED + "Invalid choice. Type \'Yes\' or \'No\'");
|
||||
return new InvitePrompt();
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -390,7 +393,7 @@ public class PlayerListener implements Listener {
|
||||
boolean okay = true;
|
||||
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(player)) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player)) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
@ -410,7 +413,7 @@ public class PlayerListener implements Listener {
|
||||
boolean okay = true;
|
||||
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(damager)) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(damager)) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
@ -456,7 +459,7 @@ public class PlayerListener implements Listener {
|
||||
boolean okay = true;
|
||||
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player) || CitizensAPI.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||
okay = false;
|
||||
}
|
||||
}
|
||||
@ -484,7 +487,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
if (plugin.citizens != null) {
|
||||
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(player) || CitizensAPI.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||
okay = false;
|
||||
}
|
||||
|
||||
@ -591,7 +594,7 @@ public class PlayerListener implements Listener {
|
||||
|
||||
boolean isPlayer = true;
|
||||
if (plugin.citizens != null) {
|
||||
if (plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||
if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||
isPlayer = false;
|
||||
}
|
||||
}
|
||||
|
@ -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,9 @@ 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 {
|
||||
|
||||
public String name;
|
||||
@ -31,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>();
|
||||
|
||||
@ -144,7 +149,13 @@ public class Quest {
|
||||
|
||||
if(quester.completedQuests.containsAll(neededQuests) == false)
|
||||
return false;
|
||||
|
||||
|
||||
for (String q : blockQuests) {
|
||||
if (quester.completedQuests.contains(q)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
@ -186,7 +197,7 @@ public class Quest {
|
||||
|
||||
for(String s : mcmmoSkills){
|
||||
|
||||
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
|
||||
new McMMOPlayer(player).getProfile().skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
|
||||
none = null;
|
||||
|
||||
}
|
||||
@ -316,6 +327,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)
|
||||
|
@ -11,6 +11,7 @@ import me.blackvein.quests.prompts.RewardsPrompt;
|
||||
import me.blackvein.quests.prompts.StagesPrompt;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -186,7 +187,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
if (context.getSessionData("npcStart") == null && quests.citizens != null) {
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (None set)\n";
|
||||
} else if (quests.citizens != null) {
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (" + quests.citizens.getNPCRegistry().getById((Integer) context.getSessionData("npcStart")).getName() + ")\n";
|
||||
text += BLUE + "" + BOLD + "5" + RESET + YELLOW + " - Set NPC start (" + CitizensAPI.getNPCRegistry().getById((Integer) context.getSessionData("npcStart")).getName() + ")\n";
|
||||
}
|
||||
|
||||
if (context.getSessionData("blockStart") == null) {
|
||||
@ -474,7 +475,7 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
if (input.intValue() > -1) {
|
||||
|
||||
if (quests.citizens.getNPCRegistry().getById(input.intValue()) == null) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(input.intValue()) == null) {
|
||||
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
||||
return new SetNpcStartPrompt();
|
||||
}
|
||||
@ -1304,6 +1305,10 @@ public class QuestFactory implements ConversationAbandonedListener, ColorUtil {
|
||||
if (q.neededQuests.isEmpty() == false) {
|
||||
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);
|
||||
@ -1649,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);
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import me.ThaH3lper.com.LoadBosses.LoadBoss;
|
||||
import me.blackvein.quests.util.ItemUtil;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
@ -2349,7 +2350,7 @@ public class Quester {
|
||||
|
||||
for (int i : ids) {
|
||||
|
||||
citizensInteracted.put(plugin.citizens.getNPCRegistry().getById(i), has.get(ids.indexOf(i)));
|
||||
citizensInteracted.put(CitizensAPI.getNPCRegistry().getById(i), has.get(ids.indexOf(i)));
|
||||
|
||||
}
|
||||
|
||||
@ -2362,7 +2363,7 @@ public class Quester {
|
||||
|
||||
for (int i : ids) {
|
||||
|
||||
citizensKilled.add(plugin.citizens.getNPCRegistry().getById(i));
|
||||
citizensKilled.add(CitizensAPI.getNPCRegistry().getById(i));
|
||||
citizenNumKilled.add(num.get(ids.indexOf(i)));
|
||||
|
||||
}
|
||||
@ -2556,7 +2557,7 @@ public class Quester {
|
||||
if (delayTimeLeft > -1) {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), delayTimeLeft * 50);
|
||||
} else {
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), currentStage.delay);
|
||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), currentStage.delay / 50);
|
||||
plugin.getServer().getPlayer(name).sendMessage(currentStage.delayMessage);
|
||||
}
|
||||
|
||||
|
@ -1,15 +1,25 @@
|
||||
package me.blackvein.quests;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.Statement;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
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.LoadBosses.LoadBoss;
|
||||
import me.blackvein.quests.prompts.QuestAcceptPrompt;
|
||||
@ -17,18 +27,32 @@ import me.blackvein.quests.util.ItemUtil;
|
||||
import me.blackvein.quests.util.Lang;
|
||||
import net.aufdemrand.denizen.Denizen;
|
||||
import net.aufdemrand.denizen.scripts.ScriptRegistry;
|
||||
import net.citizensnpcs.api.CitizensAPI;
|
||||
import net.citizensnpcs.api.CitizensPlugin;
|
||||
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.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.conversations.*;
|
||||
import org.bukkit.conversations.Conversable;
|
||||
import org.bukkit.conversations.ConversationAbandonedEvent;
|
||||
import org.bukkit.conversations.ConversationAbandonedListener;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
import org.bukkit.conversations.ConversationFactory;
|
||||
import org.bukkit.conversations.ConversationPrefix;
|
||||
import org.bukkit.conversations.Prompt;
|
||||
import org.bukkit.conversations.StringPrompt;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -40,6 +64,9 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.datatypes.skills.SkillType;
|
||||
|
||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener, ColorUtil {
|
||||
|
||||
public static Economy economy = null;
|
||||
@ -545,6 +572,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -896,7 +937,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
LinkedHashMap sortedMap = (LinkedHashMap) Quests.sort(questPoints);
|
||||
LinkedHashMap<String, Integer> sortedMap = (LinkedHashMap<String, Integer>) Quests.sort(questPoints);
|
||||
|
||||
int numPrinted = 0;
|
||||
|
||||
@ -959,7 +1000,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if(quester.currentQuest == null){
|
||||
|
||||
Party party = new Party(quester);
|
||||
Party party = new Party(this, quester);
|
||||
if(broadcastPartyCreation)
|
||||
getServer().broadcastMessage(Party.partyPrefix + PINK + "" + BOLD + player.getName() + RESET + "" + PINK + " created a Quest Party!");
|
||||
parties.add(party);
|
||||
@ -1021,7 +1062,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
LinkedList<Quester> members = party.getMembers();
|
||||
|
||||
player.sendMessage(PURPLE + "- " + PINK + "Party" + PURPLE + " -");
|
||||
player.sendMessage(YELLOW + "" + BOLD + "Current Quest: " + RESET + "" + YELLOW + current != null ? (current.getName()) : "(None)");
|
||||
player.sendMessage(YELLOW + "" + BOLD + "Current Quest: " + RESET + "" + YELLOW + ((current != null) ? current.getName() : "(None)"));
|
||||
player.sendMessage(PINK + "" + BOLD + "Leader: " + RESET + "" + PINK + leader.name);
|
||||
if(members.isEmpty())
|
||||
player.sendMessage(PURPLE + "" + BOLD + "Members: " + RESET + "" + PURPLE + "(None)");
|
||||
@ -1070,10 +1111,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
}
|
||||
|
||||
if(found != null){
|
||||
|
||||
if (found.getName().equals(player.getName())) {
|
||||
player.sendMessage(Party.partyPrefix + RED + "you can't invite yourself!");
|
||||
return true;
|
||||
}
|
||||
if(getQuester(found.getName()).getParty() == null){
|
||||
|
||||
a
|
||||
//TODO: Invite player to party!
|
||||
party.sendMessage(Party.partyPrefix + PINK + "" + BOLD + player.getName() + RESET + "" + PINK + " invited: " + BOLD + found.getName() + RESET + "" + PINK + " to the party!" );
|
||||
party.sendInvite(getQuester(found.getName()));
|
||||
|
||||
}else{
|
||||
player.sendMessage(Party.partyPrefix + RED + "" + BOLD + found.getName() + RESET + "" + RED + " is already in a party!");
|
||||
@ -1512,7 +1558,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getName().toLowerCase().contains(args[1].toLowerCase())) {
|
||||
if (p.getName().equalsIgnoreCase(args[1])) {
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
@ -1553,6 +1599,101 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
} else if (args[0].equalsIgnoreCase("takepoints")) {
|
||||
|
||||
if (player.hasPermission("quests.admin.takepoints")) {
|
||||
|
||||
Player target = null;
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getName().equalsIgnoreCase(args[1])) {
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
|
||||
player.sendMessage(YELLOW + "Player not found.");
|
||||
|
||||
} else {
|
||||
|
||||
int points;
|
||||
|
||||
try {
|
||||
|
||||
points = Integer.parseInt(args[2]);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
player.sendMessage(YELLOW + "Amount must be a number.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
quester.questPoints = points;
|
||||
player.sendMessage(GOLD + "Took away " + PURPLE + points + GOLD + " Quest Points from " + GREEN + target.getName() + GOLD + "\'s.");
|
||||
target.sendMessage(GREEN + player.getName() + GOLD + " took away " + PURPLE + points + GOLD + "Quest Points.");
|
||||
|
||||
quester.saveData();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
player.sendMessage(RED + "You do not have access to that command.");
|
||||
|
||||
}
|
||||
} else if (args[0].equalsIgnoreCase("givepoints")) {
|
||||
if (player.hasPermission("quests.admin.givepoints")) {
|
||||
|
||||
Player target = null;
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getName().equalsIgnoreCase(args[1])) {
|
||||
target = p;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (target == null) {
|
||||
|
||||
player.sendMessage(YELLOW + "Player not found.");
|
||||
|
||||
} else {
|
||||
|
||||
int points;
|
||||
|
||||
try {
|
||||
|
||||
points = Integer.parseInt(args[2]);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
player.sendMessage(YELLOW + "Amount must be a number.");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
Quester quester = getQuester(target.getName());
|
||||
quester.questPoints += points;
|
||||
player.sendMessage(GOLD + "Gave " + PURPLE + points + GOLD + " Quest Points to " + GREEN + target.getName() + GOLD + "\'s.");
|
||||
target.sendMessage(GREEN + player.getName() + GOLD + " gave you " + PURPLE + points + GOLD + "Quest Points.");
|
||||
|
||||
quester.saveData();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
player.sendMessage(RED + "You do not have access to that command.");
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
cs.sendMessage(YELLOW + "Unknown Questadmin command. Type /questadmin for help.");
|
||||
@ -1590,6 +1731,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
if (player.hasPermission("quests.admin.points")) {
|
||||
player.sendMessage(DARKRED + "/questadmin points <player> <amount>" + RED + " - Set a players Quest Points");
|
||||
}
|
||||
if (player.hasPermission("quests.admin.takepoints")) {
|
||||
player.sendMessage(DARKRED + "/questadmin takepoints <player> <amount>" + RED + " - Take a players Quest Points");
|
||||
}
|
||||
if (player.hasPermission("quests.admin.givepoints")) {
|
||||
player.sendMessage(DARKRED + "/questadmin givepoints <player> <amount>" + RED + " - Give a player Quest Points");
|
||||
}
|
||||
if (player.hasPermission("quests.admin.pointsall")) {
|
||||
player.sendMessage(DARKRED + "/questadmin pointsall <amount>" + RED + " - Set ALL players' Quest Points");
|
||||
}
|
||||
@ -1748,10 +1895,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
if (config.contains("quests." + s + ".npc-giver-id")) {
|
||||
|
||||
if (citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")) != null) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")) != null) {
|
||||
|
||||
quest.npcStart = citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id"));
|
||||
questNPCs.add(citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")));
|
||||
quest.npcStart = CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id"));
|
||||
questNPCs.add(CitizensAPI.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")));
|
||||
|
||||
} else {
|
||||
printSevere(GOLD + "[Quests] " + RED + "npc-giver-id: " + GOLD + "for Quest " + PURPLE + quest.name + GOLD + " is not a valid NPC id!");
|
||||
@ -1885,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)) {
|
||||
@ -1928,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)) {
|
||||
@ -2298,10 +2489,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
npcsToTalkTo = new LinkedList<NPC>();
|
||||
for (int i : npcIdsToTalkTo) {
|
||||
|
||||
if (citizens.getNPCRegistry().getById(i) != null) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(i) != null) {
|
||||
|
||||
npcsToTalkTo.add(citizens.getNPCRegistry().getById(i));
|
||||
questNPCs.add(citizens.getNPCRegistry().getById(i));
|
||||
npcsToTalkTo.add(CitizensAPI.getNPCRegistry().getById(i));
|
||||
questNPCs.add(CitizensAPI.getNPCRegistry().getById(i));
|
||||
|
||||
} else {
|
||||
printSevere(GOLD + "[Quests] " + RED + i + GOLD + " inside " + GREEN + "npc-ids-to-talk-to: " + GOLD + "inside " + PINK + "Stage " + s2 + GOLD + " of Quest " + PURPLE + quest.name + GOLD + " is not a valid NPC id!");
|
||||
@ -2321,7 +2512,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
List<String> itemsToDeliver;
|
||||
List<Integer> itemDeliveryTargetIds;
|
||||
ArrayList<String> deliveryMessages = new ArrayList();
|
||||
ArrayList<String> deliveryMessages = new ArrayList<String>();
|
||||
|
||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".items-to-deliver")) {
|
||||
|
||||
@ -2344,7 +2535,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
if (is != null) {
|
||||
|
||||
int npcId = itemDeliveryTargetIds.get(itemsToDeliver.indexOf(item));
|
||||
NPC npc = citizens.getNPCRegistry().getById(npcId);
|
||||
NPC npc = CitizensAPI.getNPCRegistry().getById(npcId);
|
||||
|
||||
if (npc != null) {
|
||||
|
||||
@ -2407,12 +2598,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
npcAmounts = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts");
|
||||
for (int i : npcIds) {
|
||||
|
||||
if (citizens.getNPCRegistry().getById(i) != null) {
|
||||
if (CitizensAPI.getNPCRegistry().getById(i) != null) {
|
||||
|
||||
if (npcAmounts.get(npcIds.indexOf(i)) > 0) {
|
||||
stage.citizensToKill.add(citizens.getNPCRegistry().getById(i));
|
||||
stage.citizensToKill.add(CitizensAPI.getNPCRegistry().getById(i));
|
||||
stage.citizenNumToKill.add(npcAmounts.get(npcIds.indexOf(i)));
|
||||
questNPCs.add(citizens.getNPCRegistry().getById(i));
|
||||
questNPCs.add(CitizensAPI.getNPCRegistry().getById(i));
|
||||
} else {
|
||||
printSevere(GOLD + "[Quests] " + RED + npcAmounts.get(npcIds.indexOf(i)) + GOLD + " inside " + GREEN + "npc-kill-amounts: " + GOLD + "inside " + PINK + "Stage " + s2 + GOLD + " of Quest " + PURPLE + quest.name + GOLD + " is not a positive number!");
|
||||
stageFailed = true;
|
||||
@ -3279,6 +3470,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;
|
||||
}
|
||||
@ -3316,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;
|
||||
|
||||
@ -3344,15 +3537,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
return (permission != null);
|
||||
}
|
||||
|
||||
private static Map sort(Map unsortedMap) {
|
||||
private static Map<String, Integer> sort(Map<String, Integer> unsortedMap) {
|
||||
|
||||
List list = new LinkedList(unsortedMap.entrySet());
|
||||
List<Entry<String, Integer>> list = new LinkedList<Entry<String, Integer>>(unsortedMap.entrySet());
|
||||
|
||||
Collections.sort(list, new Comparator() {
|
||||
Collections.sort(list, new Comparator<Entry<String, Integer>>() {
|
||||
@Override
|
||||
public int compare(Object o1, Object o2) {
|
||||
int i = (Integer) (((Map.Entry) o1).getValue());
|
||||
int i2 = (Integer) (((Map.Entry) o2).getValue());
|
||||
public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
|
||||
int i = o1.getValue();
|
||||
int i2 = o2.getValue();
|
||||
if (i < i2) {
|
||||
return 1;
|
||||
} else if (i == i2) {
|
||||
@ -3360,14 +3553,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Map sortedMap = new LinkedHashMap();
|
||||
for (Iterator it = list.iterator(); it.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();
|
||||
for (Iterator<Entry<String, Integer>> it = list.iterator(); it.hasNext();) {
|
||||
Entry<String, Integer> entry = it.next();
|
||||
sortedMap.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
return sortedMap;
|
||||
@ -3614,32 +3805,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
public static String getTime(long milliseconds) {
|
||||
|
||||
String message = "";
|
||||
long days = 0;
|
||||
long hours = 0;
|
||||
long minutes = 0;
|
||||
long seconds = 0;
|
||||
if (((Long) milliseconds).compareTo(Long.parseLong("86400000")) > -1) {
|
||||
days = (Long) milliseconds / Long.parseLong("86400000");
|
||||
milliseconds -= ((Long) milliseconds / Long.parseLong("86400000")) * Long.parseLong("86400000");
|
||||
}
|
||||
|
||||
if (((Long) milliseconds).compareTo(Long.parseLong("3600000")) > -1) {
|
||||
hours = (Long) milliseconds / Long.parseLong("3600000");
|
||||
milliseconds -= ((Long) milliseconds / Long.parseLong("3600000")) * Long.parseLong("3600000");
|
||||
}
|
||||
|
||||
if (((Long) milliseconds).compareTo(Long.parseLong("60000")) > -1) {
|
||||
minutes = (Long) milliseconds / Long.parseLong("60000");
|
||||
milliseconds -= ((Long) milliseconds / Long.parseLong("60000")) * Long.parseLong("60000");
|
||||
}
|
||||
|
||||
if (((Long) milliseconds).compareTo(Long.parseLong("1000")) > -1) {
|
||||
seconds = (Long) milliseconds / Long.parseLong("1000");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(milliseconds);
|
||||
|
||||
long days = calendar.get(Calendar.DAY_OF_YEAR) - 1;
|
||||
long hours = calendar.get(Calendar.HOUR_OF_DAY) - 1;
|
||||
long minutes = calendar.get(Calendar.MINUTE);
|
||||
long seconds = calendar.get(Calendar.SECOND);
|
||||
|
||||
if (days > 0) {
|
||||
|
||||
|
||||
if (days == 1) {
|
||||
message += " 1 Day,";
|
||||
} else {
|
||||
@ -3922,7 +4098,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener,
|
||||
|
||||
}
|
||||
|
||||
public static boolean checkList(List<?> list, Class c) {
|
||||
public static boolean checkList(List<?> list, Class<?> c) {
|
||||
|
||||
if (list == null) {
|
||||
return false;
|
||||
|
@ -5,9 +5,14 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import me.blackvein.quests.ColorUtil;
|
||||
import me.blackvein.quests.ItemData;
|
||||
import me.blackvein.quests.ItemData.Data;
|
||||
import me.blackvein.quests.Quester;
|
||||
import me.blackvein.quests.Quests;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.conversations.ConversationContext;
|
||||
@ -225,7 +230,6 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
if(input.equalsIgnoreCase("cancel") == false){
|
||||
|
||||
try{
|
||||
|
||||
Material mat = Material.getMaterial(Integer.parseInt(input));
|
||||
if(mat == null){
|
||||
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
|
||||
@ -236,8 +240,22 @@ public class ItemStackPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
|
||||
return new IDPrompt();
|
||||
try {
|
||||
Data data = ItemData.getInstance().getItem(input);
|
||||
if (data == null) {
|
||||
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
|
||||
return new IDPrompt();
|
||||
} else {
|
||||
|
||||
cc.setSessionData("tempId", data.getId());
|
||||
cc.setSessionData("tempData", (data.getData() == 0) ? null : (short)data.getData());
|
||||
return new ItemStackPrompt(oldPrompt);
|
||||
}
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
cc.getForWhom().sendRawMessage(RED + "Invalid item ID!");
|
||||
return new IDPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
@ -239,15 +239,12 @@ public class RequirementsPrompt extends FixedSetPrompt implements ColorUtil{
|
||||
|
||||
}
|
||||
|
||||
Collections.sort(questNames, new Comparator(){
|
||||
Collections.sort(questNames, new Comparator<String>(){
|
||||
|
||||
@Override
|
||||
public int compare(Object one, Object two){
|
||||
public int compare(String one, String two){
|
||||
|
||||
String s = (String) one;
|
||||
String s2 = (String) two;
|
||||
|
||||
return s.compareTo(s2);
|
||||
return one.compareTo(two);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user