mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-01 00:11:00 +01:00
Added NPC Effects
This commit is contained in:
parent
42c348c9f6
commit
91e1fd840d
22
.gitattributes
vendored
Normal file
22
.gitattributes
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
*.sln merge=union
|
||||||
|
*.csproj merge=union
|
||||||
|
*.vbproj merge=union
|
||||||
|
*.fsproj merge=union
|
||||||
|
*.dbproj merge=union
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
20
.gitignore
vendored
20
.gitignore
vendored
@ -1,3 +1,17 @@
|
|||||||
/lib/Quests/build/
|
nbproject/
|
||||||
/lib/Quests/dist/
|
nbproject/private/
|
||||||
/lib/Quests/nbproject/private/
|
build/
|
||||||
|
nbbuild/
|
||||||
|
dist/
|
||||||
|
nbdist/
|
||||||
|
nbactions.xml
|
||||||
|
nb-configuration.xml
|
||||||
|
nbproject\project.properties
|
||||||
|
|
||||||
|
# Class Files #
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.ear
|
@ -1,13 +1,13 @@
|
|||||||
events:
|
events:
|
||||||
ExampleEvent:
|
ExampleEvent:
|
||||||
message: '<red>Event happened!'
|
message: '<red>Event happened!'
|
||||||
potion-effect-types:
|
potion-effect-types:
|
||||||
- Speed
|
- Speed
|
||||||
- Jump
|
- Jump
|
||||||
potion-effect-durations:
|
potion-effect-durations:
|
||||||
- 100
|
- 100
|
||||||
- 25
|
- 25
|
||||||
potion-effect-amplifiers:
|
potion-effect-amplifiers:
|
||||||
- 3
|
- 3
|
||||||
- 2
|
- 2
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
X-COMMENT: Main-Class will be added automatically by build
|
X-COMMENT: Main-Class will be added automatically by build
|
||||||
|
|
||||||
|
@ -3,4 +3,4 @@ do.depend=false
|
|||||||
do.jar=true
|
do.jar=true
|
||||||
javac.debug=true
|
javac.debug=true
|
||||||
javadoc.preview=true
|
javadoc.preview=true
|
||||||
user.properties.file=/Users/136-aclarke/Library/Application Support/NetBeans/7.2.1/build.properties
|
user.properties.file=C:\\Users\\Alex\\AppData\\Roaming\\NetBeans\\7.2.1\\build.properties
|
||||||
|
@ -27,9 +27,10 @@ dist.jar=${dist.dir}/Quests.jar
|
|||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
endorsed.classpath=
|
endorsed.classpath=
|
||||||
excludes=
|
excludes=
|
||||||
|
file.reference.craftbukkit-1.5.1-R0.1.jar=lib/craftbukkit-1.5.1-R0.1.jar
|
||||||
file.reference.denizen-0.8.8-PRERELEASE.jar=lib\\denizen-0.8.8-PRERELEASE.jar
|
file.reference.denizen-0.8.8-PRERELEASE.jar=lib\\denizen-0.8.8-PRERELEASE.jar
|
||||||
file.reference.mcMMO.jar=lib\\mcMMO.jar
|
file.reference.mcMMO.jar=lib\\mcMMO.jar
|
||||||
file.reference.ProtocolLib-2.4.1.jar=lib/ProtocolLib-2.4.1.jar
|
file.reference.mysql-connector-java-5.1.24-bin.jar=C:\\Users\\Alex\\Documents\\Coding\\libraries\\mysql-connector-java-5.1.24-bin.jar
|
||||||
file.reference.Vault.jar=lib/Vault.jar
|
file.reference.Vault.jar=lib/Vault.jar
|
||||||
includes=**
|
includes=**
|
||||||
jar.archive.disabled=${jnlp.enabled}
|
jar.archive.disabled=${jnlp.enabled}
|
||||||
@ -41,7 +42,8 @@ javac.classpath=\
|
|||||||
${libs.CitizensAPI.classpath}:\
|
${libs.CitizensAPI.classpath}:\
|
||||||
${file.reference.mcMMO.jar}:\
|
${file.reference.mcMMO.jar}:\
|
||||||
${file.reference.denizen-0.8.8-PRERELEASE.jar}:\
|
${file.reference.denizen-0.8.8-PRERELEASE.jar}:\
|
||||||
${file.reference.ProtocolLib-2.4.1.jar}
|
${file.reference.mysql-connector-java-5.1.24-bin.jar}:\
|
||||||
|
${file.reference.craftbukkit-1.5.1-R0.1.jar}
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
192
pom.xml
192
pom.xml
@ -1,97 +1,97 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>me.blackvein.quests</groupId>
|
<groupId>me.blackvein.quests</groupId>
|
||||||
<artifactId>quests</artifactId>
|
<artifactId>quests</artifactId>
|
||||||
<version>1.5.2-SNAPSHOT</version>
|
<version>1.5.2-SNAPSHOT</version>
|
||||||
<name>quests</name>
|
<name>quests</name>
|
||||||
<url>http://dev.bukkit.org/server-mods/quests/</url>
|
<url>http://dev.bukkit.org/server-mods/quests/</url>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<description></description>
|
<description></description>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>bukkit-repo</id>
|
<id>bukkit-repo</id>
|
||||||
<url>http://repo.bukkit.org/content/groups/public</url>
|
<url>http://repo.bukkit.org/content/groups/public</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>citizensapi-repo</id>
|
<id>citizensapi-repo</id>
|
||||||
<url>http://ci.citizensnpcs.com/plugin/repository/everything</url>
|
<url>http://ci.citizensnpcs.com/plugin/repository/everything</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>denizens-repo</id>
|
<id>denizens-repo</id>
|
||||||
<url>http://ci.citizensnpcs.com/view/Characters/job/Denizen/592/maven-repository/repository/</url>
|
<url>http://ci.citizensnpcs.com/view/Characters/job/Denizen/592/maven-repository/repository/</url>
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>vault-repo</id>
|
<id>vault-repo</id>
|
||||||
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
|
<url>http://ci.herocraftonline.com/plugin/repository/everything</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bukkit</groupId>
|
<groupId>org.bukkit</groupId>
|
||||||
<artifactId>bukkit</artifactId>
|
<artifactId>bukkit</artifactId>
|
||||||
<version>1.4.2-R0.2</version>
|
<version>1.4.2-R0.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.citizensnpcs</groupId>
|
<groupId>net.citizensnpcs</groupId>
|
||||||
<artifactId>citizensapi</artifactId>
|
<artifactId>citizensapi</artifactId>
|
||||||
<version>2.0.4-SNAPSHOT</version>
|
<version>2.0.4-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.aufdemrand</groupId>
|
<groupId>net.aufdemrand</groupId>
|
||||||
<artifactId>denizen</artifactId>
|
<artifactId>denizen</artifactId>
|
||||||
<version>0.76-SNAPSHOT</version>
|
<version>0.76-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.milkbowl.vault</groupId>
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
<artifactId>Vault</artifactId>
|
<artifactId>Vault</artifactId>
|
||||||
<version>1.2.22-SNAPSHOT</version>
|
<version>1.2.22-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>1.3.11</version>
|
<version>1.3.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>
|
<targetPath>.</targetPath>
|
||||||
<directory>${basedir}/src/main/resources/</directory>
|
<directory>${basedir}/src/main/resources/</directory>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
<includes>
|
<includes>
|
||||||
<include>config.yml</include>
|
<include>config.yml</include>
|
||||||
<include>plugin.yml</include>
|
<include>plugin.yml</include>
|
||||||
<include>events.yml</include>
|
<include>events.yml</include>
|
||||||
<include>quests.yml</include>
|
<include>quests.yml</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<targetPath>.</targetPath>
|
<targetPath>.</targetPath>
|
||||||
<directory>${basedir}/</directory>
|
<directory>${basedir}/</directory>
|
||||||
<filtering>false</filtering>
|
<filtering>false</filtering>
|
||||||
<includes>
|
<includes>
|
||||||
<include>README.md</include>
|
<include>README.md</include>
|
||||||
</includes>
|
</includes>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>2.3.2</version>
|
<version>2.3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<showDeprecation>true</showDeprecation>
|
<showDeprecation>true</showDeprecation>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
BIN
src/.DS_Store
vendored
Normal file
BIN
src/.DS_Store
vendored
Normal file
Binary file not shown.
@ -25,6 +25,8 @@ allow-quitting: true
|
|||||||
debug-mode: false
|
debug-mode: false
|
||||||
kill-delay: 600
|
kill-delay: 600
|
||||||
snoop: true
|
snoop: true
|
||||||
|
show-npc-effects: true
|
||||||
|
npc-effect: "note"
|
||||||
quester-blacklist:
|
quester-blacklist:
|
||||||
- "SomeGuy12345"
|
- "SomeGuy12345"
|
||||||
- "somePrefix*"
|
- "somePrefix*"
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
events:
|
events:
|
||||||
ExampleEvent:
|
ExampleEvent:
|
||||||
message: '<red>Event happened!'
|
message: '<red>Event happened!'
|
||||||
potion-effect-types:
|
potion-effect-types:
|
||||||
- Speed
|
- Speed
|
||||||
- Jump
|
- Jump
|
||||||
potion-effect-durations:
|
potion-effect-durations:
|
||||||
- 100
|
- 100
|
||||||
- 25
|
- 25
|
||||||
potion-effect-amplifiers:
|
potion-effect-amplifiers:
|
||||||
- 3
|
- 3
|
||||||
- 2
|
- 2
|
||||||
|
|
||||||
|
@ -126,15 +126,15 @@ public class Event {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getName(){
|
public String getName(){
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void happen(Quester quester){
|
public void happen(Quester quester){
|
||||||
|
|
||||||
Player player = quester.getPlayer();
|
Player player = quester.getPlayer();
|
||||||
|
|
||||||
if(message != null)
|
if(message != null)
|
||||||
player.sendMessage(Quests.parseString(message, quester.currentQuest));
|
player.sendMessage(Quests.parseString(message, quester.currentQuest));
|
||||||
|
|
||||||
|
160
src/me/blackvein/quests/NpcEffectThread.java
Normal file
160
src/me/blackvein/quests/NpcEffectThread.java
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
package me.blackvein.quests;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class NpcEffectThread implements Runnable{
|
||||||
|
|
||||||
|
final Quests plugin;
|
||||||
|
|
||||||
|
public NpcEffectThread(Quests quests){
|
||||||
|
|
||||||
|
plugin = quests;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(){
|
||||||
|
|
||||||
|
for(Player player : plugin.getServer().getOnlinePlayers()){
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
List<Entity> nearby = player.getNearbyEntities(32.0, 32.0, 32.0);
|
||||||
|
if(nearby.isEmpty() == false){
|
||||||
|
|
||||||
|
for(Entity e : nearby){
|
||||||
|
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(e)){
|
||||||
|
|
||||||
|
NPC npc = plugin.citizens.getNPCRegistry().getNPC(e);
|
||||||
|
if(plugin.hasQuest(npc, quester))
|
||||||
|
showEffect(player, npc);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void showEffect(Player player, NPC npc){
|
||||||
|
|
||||||
|
if(Quests.effect.equalsIgnoreCase("enchant")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.ENCHANTMENT_TABLE.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 10);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("crit")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("spell")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.INSTANT_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("magiccrit")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.MAGIC_CRIT.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, (float)0.35, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("mobspell")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.MOB_SPELL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("note")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||||
|
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||||
|
ParticleEffect.NOTE.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("portal")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.PORTAL.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 5);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("dust")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||||
|
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||||
|
ParticleEffect.RED_DUST.sendToPlayer(player, newLoc, 0, 0, 0, 1, 1);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("witch")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.WITCH_MAGIC.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 0, 0, 1, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("snowball")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||||
|
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||||
|
ParticleEffect.SNOWBALL_POOF.sendToPlayer(player, newLoc, 0, 0, 0, 1, 3);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("splash")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
Location old = npc.getBukkitEntity().getEyeLocation();
|
||||||
|
Location newLoc = new Location(player.getWorld(), old.getX(), old.getY() + (float)0.5, old.getZ());
|
||||||
|
ParticleEffect.SPLASH.sendToPlayer(player, newLoc, 0, 0, 0, 1, 4);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(Quests.effect.equalsIgnoreCase("smoke")){
|
||||||
|
|
||||||
|
try{
|
||||||
|
ParticleEffect.TOWN_AURA.sendToPlayer(player, npc.getBukkitEntity().getEyeLocation(), 0, 1, 0, 1, 20);
|
||||||
|
}catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else{
|
||||||
|
|
||||||
|
Quests.log.severe("[Quests] No particle effect specified!");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -16,7 +16,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class NpcListener implements Listener {
|
public class NpcListener implements Listener {
|
||||||
|
|
||||||
Quests plugin;
|
final Quests plugin;
|
||||||
|
|
||||||
public NpcListener(Quests newPlugin) {
|
public NpcListener(Quests newPlugin) {
|
||||||
|
|
||||||
@ -31,15 +31,15 @@ public class NpcListener implements Listener {
|
|||||||
final Quester quester = plugin.getQuester(player.getName());
|
final Quester quester = plugin.getQuester(player.getName());
|
||||||
boolean delivery = false;
|
boolean delivery = false;
|
||||||
|
|
||||||
if (quester.hasObjective("deliverItem") && player.getItemInHand() != null) {
|
if(quester.hasObjective("deliverItem") && player.getItemInHand() != null){
|
||||||
|
|
||||||
ItemStack hand = player.getItemInHand();
|
ItemStack hand = player.getItemInHand();
|
||||||
if (quester.itemsDelivered.containsKey(hand.getType())) {
|
if(quester.itemsDelivered.containsKey(hand.getType())){
|
||||||
|
|
||||||
NPC clicked = evt.getNPC();
|
NPC clicked = evt.getNPC();
|
||||||
|
|
||||||
for (NPC n : quester.currentStage.itemDeliveryTargets) {
|
for(NPC n : quester.currentStage.itemDeliveryTargets){
|
||||||
if (n.getId() == clicked.getId()) {
|
if(n.getId() == clicked.getId()){
|
||||||
quester.deliverItem(hand);
|
quester.deliverItem(hand);
|
||||||
delivery = true;
|
delivery = true;
|
||||||
break;
|
break;
|
||||||
@ -92,13 +92,13 @@ public class NpcListener implements Listener {
|
|||||||
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
|
player.sendMessage(ChatColor.YELLOW + "You may not take " + ChatColor.AQUA + q.name + ChatColor.YELLOW + " again for another " + ChatColor.DARK_PURPLE + Quests.getTime(quester.getDifference(q)) + ChatColor.YELLOW + ".");
|
||||||
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
} else if (quester.completedQuests.contains(q.name) && q.redoDelay < 0) {
|
||||||
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
|
player.sendMessage(ChatColor.YELLOW + "You have already completed " + ChatColor.AQUA + q.name + ChatColor.YELLOW + ".");
|
||||||
} else {
|
}else{
|
||||||
|
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.name;
|
||||||
String s =
|
String s =
|
||||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
|
|
||||||
player.sendMessage(s);
|
player.sendMessage(s);
|
||||||
|
|
||||||
@ -130,47 +130,63 @@ public class NpcListener implements Listener {
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNPCDeath(NPCDeathEvent evt) {
|
public void onNPCDeath(NPCDeathEvent evt) {
|
||||||
|
|
||||||
if (evt.getNPC().getBukkitEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
if (evt.getNPC().getBukkitEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||||
|
|
||||||
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getNPC().getBukkitEntity().getLastDamageCause();
|
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getNPC().getBukkitEntity().getLastDamageCause();
|
||||||
Entity damager = damageEvent.getDamager();
|
Entity damager = damageEvent.getDamager();
|
||||||
|
|
||||||
if (damager != null) {
|
if (damager != null) {
|
||||||
|
|
||||||
if (damager instanceof Projectile) {
|
if (damager instanceof Projectile) {
|
||||||
|
|
||||||
Projectile p = (Projectile) damager;
|
Projectile p = (Projectile) damager;
|
||||||
if (p.getShooter() instanceof Player) {
|
if (p.getShooter() instanceof Player) {
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
if (plugin.checkQuester(player.getName()) == false) {
|
boolean okay = true;
|
||||||
|
|
||||||
|
if (plugin.citizens != null) {
|
||||||
|
if (plugin.citizens.getNPCRegistry().isNPC(player)) {
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (okay) {
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if (quester.hasObjective("killNPC")) {
|
||||||
|
quester.killNPC(evt.getNPC());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (damager instanceof Player) {
|
||||||
|
|
||||||
|
boolean okay = true;
|
||||||
|
|
||||||
|
if (plugin.citizens != null) {
|
||||||
|
if (plugin.citizens.getNPCRegistry().isNPC(damager)) {
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (okay) {
|
||||||
|
|
||||||
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if (quester.hasObjective("killNPC")) {
|
if (quester.hasObjective("killNPC")) {
|
||||||
quester.killNPC(evt.getNPC());
|
quester.killNPC(evt.getNPC());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (damager instanceof Player) {
|
|
||||||
|
|
||||||
Player player = (Player) damager;
|
|
||||||
|
|
||||||
if (plugin.checkQuester(player.getName()) == false) {
|
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
|
||||||
if (quester.hasObjective("killNPC")) {
|
|
||||||
quester.killNPC(evt.getNPC());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
66
src/me/blackvein/quests/ParticleEffect.java
Normal file
66
src/me/blackvein/quests/ParticleEffect.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package me.blackvein.quests;
|
||||||
|
|
||||||
|
import net.minecraft.server.v1_5_R2.Packet63WorldParticles;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_5_R2.entity.CraftPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public enum ParticleEffect {
|
||||||
|
|
||||||
|
HUGE_EXPLOSION("hugeexplosion"),
|
||||||
|
LARGE_EXPLODE("largeexplode"),
|
||||||
|
FIREWORKS_SPARK("fireworksSpark"),
|
||||||
|
BUBBLE("bubble"),
|
||||||
|
SUSPEND("suspend"),
|
||||||
|
DEPTH_SUSPEND("depthSuspend"),
|
||||||
|
TOWN_AURA("townaura"),
|
||||||
|
CRIT("crit"),
|
||||||
|
MAGIC_CRIT("magicCrit"),
|
||||||
|
MOB_SPELL("mobSpell"),
|
||||||
|
MOB_SPELL_AMBIENT("mobSpellAmbient"),
|
||||||
|
SPELL("spell"),
|
||||||
|
INSTANT_SPELL("instantSpell"),
|
||||||
|
WITCH_MAGIC("witchMagic"),
|
||||||
|
NOTE("note"),
|
||||||
|
PORTAL("portal"),
|
||||||
|
ENCHANTMENT_TABLE("enchantmenttable"),
|
||||||
|
EXPLODE("explode"),
|
||||||
|
FLAME("flame"),
|
||||||
|
LAVA("lava"),
|
||||||
|
FOOTSTEP("footstep"),
|
||||||
|
SPLASH("splash"),
|
||||||
|
LARGE_SMOKE("largesmoke"),
|
||||||
|
CLOUD("cloud"),
|
||||||
|
RED_DUST("reddust"),
|
||||||
|
SNOWBALL_POOF("snowballpoof"),
|
||||||
|
DRIP_WATER("dripWater"),
|
||||||
|
DRIP_LAVA("dripLava"),
|
||||||
|
SNOW_SHOVEL("snowshovel"),
|
||||||
|
SLIME("slime"),
|
||||||
|
HEART("heart"),
|
||||||
|
ANGRY_VILLAGER("angryVillager"),
|
||||||
|
HAPPY_VILLAGER("happerVillager"),
|
||||||
|
ICONCRACK("iconcrack_"),
|
||||||
|
TILECRACK("tilecrack_");
|
||||||
|
|
||||||
|
private String particleName;
|
||||||
|
|
||||||
|
ParticleEffect(String particleName) {
|
||||||
|
this.particleName = particleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendToPlayer(Player player, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) throws Exception {
|
||||||
|
Packet63WorldParticles packet = new Packet63WorldParticles();
|
||||||
|
ReflectionUtilities.setValue(packet, "a", particleName);
|
||||||
|
ReflectionUtilities.setValue(packet, "b", (float) location.getX());
|
||||||
|
ReflectionUtilities.setValue(packet, "c", (float) location.getY());
|
||||||
|
ReflectionUtilities.setValue(packet, "d", (float) location.getZ());
|
||||||
|
ReflectionUtilities.setValue(packet, "e", offsetX);
|
||||||
|
ReflectionUtilities.setValue(packet, "f", offsetY);
|
||||||
|
ReflectionUtilities.setValue(packet, "g", offsetZ);
|
||||||
|
ReflectionUtilities.setValue(packet, "h", speed);
|
||||||
|
ReflectionUtilities.setValue(packet, "i", count);
|
||||||
|
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ package me.blackvein.quests;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@ -25,7 +26,7 @@ import org.bukkit.event.player.PlayerFishEvent.State;
|
|||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
|
|
||||||
Quests plugin;
|
final Quests plugin;
|
||||||
|
|
||||||
public PlayerListener(Quests newPlugin) {
|
public PlayerListener(Quests newPlugin) {
|
||||||
|
|
||||||
@ -450,6 +451,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (p.getShooter() instanceof Player) {
|
if (p.getShooter() instanceof Player) {
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
|
|
||||||
if (plugin.checkQuester(player.getName()) == false) {
|
if (plugin.checkQuester(player.getName()) == false) {
|
||||||
|
|
||||||
boolean okay = true;
|
boolean okay = true;
|
||||||
|
@ -393,14 +393,14 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
|
|
||||||
return ChatColor.YELLOW + "Enter NPC ID, or 0 to clear the NPC start, or -1 to cancel";
|
return ChatColor.YELLOW + "Enter NPC ID, or -1 to clear the NPC start, or -2 to cancel";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
|
||||||
|
|
||||||
if (input.intValue() > 0) {
|
if (input.intValue() > -1) {
|
||||||
|
|
||||||
if (quests.citizens.getNPCRegistry().getById(input.intValue()) == null) {
|
if (quests.citizens.getNPCRegistry().getById(input.intValue()) == null) {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
||||||
@ -410,10 +410,10 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
context.setSessionData("npcStart", input.intValue());
|
context.setSessionData("npcStart", input.intValue());
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
|
|
||||||
} else if (input.intValue() == 0) {
|
} else if (input.intValue() == -1) {
|
||||||
context.setSessionData("npcStart", null);
|
context.setSessionData("npcStart", null);
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
} else if (input.intValue() == -1) {
|
} else if (input.intValue() == -2) {
|
||||||
return new CreateMenuPrompt();
|
return new CreateMenuPrompt();
|
||||||
} else {
|
} else {
|
||||||
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
context.getForWhom().sendRawMessage(ChatColor.RED + "No NPC exists with that id!");
|
||||||
@ -853,9 +853,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
LinkedList<String> shearColors;
|
LinkedList<String> shearColors;
|
||||||
LinkedList<Integer> shearAmounts;
|
LinkedList<Integer> shearAmounts;
|
||||||
|
|
||||||
LinkedList<Integer> npcKillIds;
|
|
||||||
LinkedList<Integer> npcKillAmounts;
|
|
||||||
|
|
||||||
String script;
|
String script;
|
||||||
String event;
|
String event;
|
||||||
@ -911,9 +908,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
|
|
||||||
shearColors = null;
|
shearColors = null;
|
||||||
shearAmounts = null;
|
shearAmounts = null;
|
||||||
|
|
||||||
npcKillIds = null;
|
|
||||||
npcKillAmounts = null;
|
|
||||||
|
|
||||||
script = null;
|
script = null;
|
||||||
event = null;
|
event = null;
|
||||||
@ -991,11 +985,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
shearColors = (LinkedList<String>) cc.getSessionData(pref + "shearColors");
|
shearColors = (LinkedList<String>) cc.getSessionData(pref + "shearColors");
|
||||||
shearAmounts = (LinkedList<Integer>) cc.getSessionData(pref + "shearAmounts");
|
shearAmounts = (LinkedList<Integer>) cc.getSessionData(pref + "shearAmounts");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cc.getSessionData(pref + "npcIdsToKill") != null) {
|
|
||||||
npcKillIds = (LinkedList<Integer>) cc.getSessionData(pref + "npcIdsToKill");
|
|
||||||
npcKillAmounts = (LinkedList<Integer>) cc.getSessionData(pref + "npcAmountsToKill");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cc.getSessionData(pref + "event") != null) {
|
if (cc.getSessionData(pref + "event") != null) {
|
||||||
event = (String) cc.getSessionData(pref + "event");
|
event = (String) cc.getSessionData(pref + "event");
|
||||||
@ -1042,8 +1031,6 @@ public class QuestFactory implements ConversationAbandonedListener {
|
|||||||
stage.set("mob-tame-amounts", tameAmounts);
|
stage.set("mob-tame-amounts", tameAmounts);
|
||||||
stage.set("sheep-to-shear", shearColors);
|
stage.set("sheep-to-shear", shearColors);
|
||||||
stage.set("sheep-amounts", shearAmounts);
|
stage.set("sheep-amounts", shearAmounts);
|
||||||
stage.set("npc-ids-to-kill", npcKillIds);
|
|
||||||
stage.set("npc-kill-amounts", npcKillAmounts);
|
|
||||||
stage.set("script-to-run", script);
|
stage.set("script-to-run", script);
|
||||||
stage.set("event", event);
|
stage.set("event", event);
|
||||||
stage.set("delay", delay);
|
stage.set("delay", delay);
|
||||||
|
@ -363,7 +363,7 @@ public class Quester {
|
|||||||
|
|
||||||
if (((Boolean) e.getValue()) == false) {
|
if (((Boolean) e.getValue()) == false) {
|
||||||
|
|
||||||
unfinishedObjectives.add(ChatColor.GREEN + "Talk to " + n.getName());
|
unfinishedObjectives.add(ChatColor.GREEN + "Talk to " + n.getFullName());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -383,11 +383,11 @@ public class Quester {
|
|||||||
|
|
||||||
if (citizenNumKilled.get(citizensKilled.indexOf(n2)) < currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n))) {
|
if (citizenNumKilled.get(citizensKilled.indexOf(n2)) < currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n))) {
|
||||||
|
|
||||||
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + n.getName() + ChatColor.GREEN + citizenNumKilled.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
|
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + n.getName() + ChatColor.GREEN + " " + citizenNumKilled.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
finishedObjectives.add(ChatColor.GRAY + "Kill " + n.getName() + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
|
finishedObjectives.add(ChatColor.GRAY + "Kill " + n.getName() + " " + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public static Permission permission = null;
|
public static Permission permission = null;
|
||||||
public static mcMMO mcmmo = null;
|
public static mcMMO mcmmo = null;
|
||||||
public static boolean snoop = true;
|
public static boolean snoop = true;
|
||||||
|
public static boolean npcEffects = true;
|
||||||
|
public static String effect = "note";
|
||||||
List<String> questerBlacklist = new LinkedList<String>();
|
List<String> questerBlacklist = new LinkedList<String>();
|
||||||
ConversationFactory conversationFactory;
|
ConversationFactory conversationFactory;
|
||||||
QuestFactory questFactory;
|
QuestFactory questFactory;
|
||||||
@ -48,6 +50,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
Vault vault = null;
|
Vault vault = null;
|
||||||
public CitizensPlugin citizens;
|
public CitizensPlugin citizens;
|
||||||
PlayerListener pListener;
|
PlayerListener pListener;
|
||||||
|
NpcEffectThread effListener;
|
||||||
NpcListener npcListener;
|
NpcListener npcListener;
|
||||||
public Denizen denizen = null;
|
public Denizen denizen = null;
|
||||||
QuestTaskTrigger trigger;
|
QuestTaskTrigger trigger;
|
||||||
@ -69,6 +72,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
pListener = new PlayerListener(this);
|
pListener = new PlayerListener(this);
|
||||||
|
effListener = new NpcEffectThread(this);
|
||||||
npcListener = new NpcListener(this);
|
npcListener = new NpcListener(this);
|
||||||
|
|
||||||
this.conversationFactory = new ConversationFactory(this)
|
this.conversationFactory = new ConversationFactory(this)
|
||||||
@ -154,6 +158,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
getServer().getPluginManager().registerEvents(pListener, this);
|
getServer().getPluginManager().registerEvents(pListener, this);
|
||||||
|
if(npcEffects)
|
||||||
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, effListener, 20, 20);
|
||||||
printInfo("[Quests] Enabled.");
|
printInfo("[Quests] Enabled.");
|
||||||
|
|
||||||
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
getServer().getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@ -233,7 +239,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
@Override
|
@Override
|
||||||
public String getPrefix(ConversationContext context) {
|
public String getPrefix(ConversationContext context) {
|
||||||
|
|
||||||
return ChatColor.GREEN + "Quests: " + ChatColor.GRAY;
|
return "" + ChatColor.GRAY;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,14 +253,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
showQuestReqs = config.getBoolean("show-requirements");
|
showQuestReqs = config.getBoolean("show-requirements");
|
||||||
allowQuitting = config.getBoolean("allow-quitting");
|
allowQuitting = config.getBoolean("allow-quitting");
|
||||||
snoop = config.getBoolean("snoop", true);
|
snoop = config.getBoolean("snoop", true);
|
||||||
|
npcEffects = config.getBoolean("show-npc-effects", true);
|
||||||
|
effect = config.getString("npc-effect", "note");
|
||||||
debug = config.getBoolean("debug-mode");
|
debug = config.getBoolean("debug-mode");
|
||||||
killDelay = config.getInt("kill-delay");
|
killDelay = config.getInt("kill-delay");
|
||||||
for (String s : config.getStringList("quester-blacklist")) {
|
for (String s : config.getStringList("quester-blacklist"))
|
||||||
|
|
||||||
questerBlacklist.add(s);
|
questerBlacklist.add(s);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void printHelp(Player player) {
|
public void printHelp(Player player) {
|
||||||
@ -3906,4 +3911,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasQuest(NPC npc, Quester quester){
|
||||||
|
|
||||||
|
for(Quest quest : quests){
|
||||||
|
|
||||||
|
if(quest.npcStart != null && quester.completedQuests.contains(quest.name) == false){
|
||||||
|
|
||||||
|
if(quest.npcStart.getId() == npc.getId())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
19
src/me/blackvein/quests/ReflectionUtilities.java
Normal file
19
src/me/blackvein/quests/ReflectionUtilities.java
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package me.blackvein.quests;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
public class ReflectionUtilities {
|
||||||
|
|
||||||
|
public static void setValue(Object instance, String fieldName, Object value) throws Exception {
|
||||||
|
Field field = instance.getClass().getDeclaredField(fieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(instance, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object getValue(Object instance, String fieldName) throws Exception {
|
||||||
|
Field field = instance.getClass().getDeclaredField(fieldName);
|
||||||
|
field.setAccessible(true);
|
||||||
|
return field.get(instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
12
src/me/blackvein/quests/particles
Normal file
12
src/me/blackvein/quests/particles
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
enchant
|
||||||
|
crit
|
||||||
|
spell
|
||||||
|
magiccrit
|
||||||
|
mobspell
|
||||||
|
note
|
||||||
|
portal
|
||||||
|
dust
|
||||||
|
witch
|
||||||
|
snowball
|
||||||
|
splash
|
||||||
|
smoke
|
@ -46,7 +46,7 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
public CreateStagePrompt(int stageNum, QuestFactory qf, CitizensPlugin cit) {
|
public CreateStagePrompt(int stageNum, QuestFactory qf, CitizensPlugin cit) {
|
||||||
|
|
||||||
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21");
|
super("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
|
||||||
this.stageNum = stageNum;
|
this.stageNum = stageNum;
|
||||||
this.pref = "stage" + stageNum;
|
this.pref = "stage" + stageNum;
|
||||||
this.citizens = cit;
|
this.citizens = cit;
|
||||||
@ -278,63 +278,43 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(questFactory.quests.citizens != null){
|
|
||||||
|
|
||||||
if (context.getSessionData(pref + "npcIdsToKill") == null) {
|
|
||||||
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Kill NPCs " + GRAY + "(None set)\n";
|
|
||||||
} else {
|
|
||||||
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Kill NPCs\n";
|
|
||||||
|
|
||||||
LinkedList<Integer> npcs = (LinkedList<Integer>) context.getSessionData(pref + "npcIdsToKill");
|
|
||||||
LinkedList<Integer> amounts = (LinkedList<Integer>) context.getSessionData(pref + "npcAmountsToKill");
|
|
||||||
|
|
||||||
for (int i = 0; i < npcs.size(); i++) {
|
|
||||||
text += GRAY + " - " + BLUE + citizens.getNPCRegistry().getById(npcs.get(i)).getName() + GRAY + " x " + AQUA + amounts.get(i) + "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
text += GRAY + "" + BOLD + "15 " + RESET + GRAY + "- Kill NPCs " + GRAY + "(Citizens not installed)\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.getSessionData(pref + "event") == null) {
|
if (context.getSessionData(pref + "event") == null) {
|
||||||
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Event " + GRAY + "(None set)\n";
|
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Event " + GRAY + "(None set)\n";
|
||||||
} else {
|
} else {
|
||||||
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Event " + GRAY + "(" + AQUA + context.getSessionData(pref + "event") + GRAY + ")\n";
|
text += PINK + "" + BOLD + "15 " + RESET + PURPLE + "- Event " + GRAY + "(" + AQUA + context.getSessionData(pref + "event") + GRAY + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.getSessionData(pref + "delay") == null) {
|
if (context.getSessionData(pref + "delay") == null) {
|
||||||
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay " + GRAY + "(None set)\n";
|
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Delay " + GRAY + "(None set)\n";
|
||||||
} else {
|
} else {
|
||||||
long time = (Long) context.getSessionData(pref + "delay");
|
long time = (Long) context.getSessionData(pref + "delay");
|
||||||
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay " + GRAY + "(" + AQUA + Quests.getTime(time) + GRAY + ")\n";
|
text += PINK + "" + BOLD + "16 " + RESET + PURPLE + "- Delay " + GRAY + "(" + AQUA + Quests.getTime(time) + GRAY + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(context.getSessionData(pref + "delay") == null){
|
if(context.getSessionData(pref + "delay") == null){
|
||||||
text += GRAY + "" + BOLD + "18 " + RESET + GRAY + "- Delay Message " + GRAY + "(No delay set)\n";
|
text += GRAY + "" + BOLD + "17 " + RESET + GRAY + "- Delay Message " + GRAY + "(No delay set)\n";
|
||||||
}else if(context.getSessionData(pref + "delayMessage") == null){
|
}else if(context.getSessionData(pref + "delayMessage") == null){
|
||||||
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Delay Message " + GRAY + "(None set)\n";
|
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay Message " + GRAY + "(None set)\n";
|
||||||
}else{
|
}else{
|
||||||
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Delay Message " + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + "delayMessage") + "\"" + GRAY + ")\n";
|
text += PINK + "" + BOLD + "17 " + RESET + PURPLE + "- Delay Message " + GRAY + "(" + AQUA + "\"" + context.getSessionData(pref + "delayMessage") + "\"" + GRAY + ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(questFactory.quests.denizen == null){
|
if(questFactory.quests.denizen == null){
|
||||||
text += GRAY + "" + BOLD + "19 " + RESET + GRAY + "- Denizen Script " + GRAY + "(Denizen not installed)\n";
|
text += GRAY + "" + BOLD + "18 " + RESET + GRAY + "- Denizen Script " + GRAY + "(Denizen not installed)\n";
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
if(context.getSessionData(pref + "denizen") == null){
|
if(context.getSessionData(pref + "denizen") == null){
|
||||||
text += GRAY + "" + BOLD + "19 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(None set)\n";
|
text += GRAY + "" + BOLD + "18 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(None set)\n";
|
||||||
}else{
|
}else{
|
||||||
text += PINK + "" + BOLD + "19 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(" + AQUA + context.getSessionData(pref + "denizen") + GRAY + "\n";
|
text += PINK + "" + BOLD + "18 " + RESET + PURPLE + "- Denizen Script " + GRAY + "(" + AQUA + context.getSessionData(pref + "denizen") + GRAY + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
text += RED + "" + BOLD + "20 " + RESET + PURPLE + "- Delete Stage\n";
|
text += RED + "" + BOLD + "19 " + RESET + PURPLE + "- Delete Stage\n";
|
||||||
text += GREEN + "" + BOLD + "21 " + RESET + PURPLE + "- Done\n";
|
text += GREEN + "" + BOLD + "20 " + RESET + PURPLE + "- Done\n";
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
|
|
||||||
@ -382,31 +362,24 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
} else if (input.equalsIgnoreCase("14")) {
|
} else if (input.equalsIgnoreCase("14")) {
|
||||||
return new ShearListPrompt();
|
return new ShearListPrompt();
|
||||||
} else if (input.equalsIgnoreCase("15")) {
|
} else if (input.equalsIgnoreCase("15")) {
|
||||||
if(questFactory.quests.citizens != null)
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
else{
|
|
||||||
context.getForWhom().sendRawMessage(RED + "Citizens is not installed!");
|
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
|
||||||
}
|
|
||||||
} else if (input.equalsIgnoreCase("16")) {
|
|
||||||
return new EventPrompt();
|
return new EventPrompt();
|
||||||
} else if (input.equalsIgnoreCase("17")) {
|
} else if (input.equalsIgnoreCase("16")) {
|
||||||
return new DelayPrompt();
|
return new DelayPrompt();
|
||||||
} else if (input.equalsIgnoreCase("18")) {
|
} else if (input.equalsIgnoreCase("17")) {
|
||||||
if(context.getSessionData(pref + "delay") == null){
|
if(context.getSessionData(pref + "delay") == null){
|
||||||
context.getForWhom().sendRawMessage(RED + "You must set a delay first!");
|
context.getForWhom().sendRawMessage(RED + "You must set a delay first!");
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
}else
|
}else
|
||||||
return new DelayMessagePrompt();
|
return new DelayMessagePrompt();
|
||||||
} else if (input.equalsIgnoreCase("19")) {
|
} else if (input.equalsIgnoreCase("18")) {
|
||||||
if(questFactory.quests.denizen == null){
|
if(questFactory.quests.denizen == null){
|
||||||
context.getForWhom().sendRawMessage(RED + "Denizen is not installed!");
|
context.getForWhom().sendRawMessage(RED + "Denizen is not installed!");
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
}else
|
}else
|
||||||
return new DenizenPrompt();
|
return new DenizenPrompt();
|
||||||
} else if (input.equalsIgnoreCase("20")) {
|
} else if (input.equalsIgnoreCase("19")) {
|
||||||
return new DeletePrompt();
|
return new DeletePrompt();
|
||||||
} else if (input.equalsIgnoreCase("21")) {
|
} else if (input.equalsIgnoreCase("20")) {
|
||||||
return new StagesPrompt(questFactory);
|
return new StagesPrompt(questFactory);
|
||||||
} else {
|
} else {
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
||||||
@ -3468,196 +3441,4 @@ public class CreateStagePrompt extends FixedSetPrompt {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NPCKillListPrompt extends FixedSetPrompt {
|
|
||||||
|
|
||||||
public NPCKillListPrompt() {
|
|
||||||
|
|
||||||
super("1", "2", "3", "4", "5", "6");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext context) {
|
|
||||||
|
|
||||||
String text = GOLD + "- Kill NPCs -\n";
|
|
||||||
if (context.getSessionData(pref + "npcIdsToKill") == null) {
|
|
||||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set NPC IDs (None set)\n";
|
|
||||||
text += GRAY + "2 - Set kill amounts (No NPC IDs set)\n";
|
|
||||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
|
|
||||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
|
|
||||||
} else {
|
|
||||||
|
|
||||||
text += BLUE + "" + BOLD + "1" + RESET + YELLOW + " - Set NPC IDs\n";
|
|
||||||
for (int i : getNPCIds(context)) {
|
|
||||||
|
|
||||||
text += GRAY + " - " + AQUA + citizens.getNPCRegistry().getById(i).getName() + " (" + i + ")\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.getSessionData(pref + "npcAmountsToKill") == null) {
|
|
||||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts (None set)\n";
|
|
||||||
} else {
|
|
||||||
|
|
||||||
text += BLUE + "" + BOLD + "2" + RESET + YELLOW + " - Set kill amounts\n";
|
|
||||||
for (Integer i : getKillAmounts(context)) {
|
|
||||||
|
|
||||||
text += GRAY + " - " + AQUA + i + "\n";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
text += BLUE + "" + BOLD + "3" + RESET + YELLOW + " - Clear\n";
|
|
||||||
text += BLUE + "" + BOLD + "4" + RESET + YELLOW + " - Done";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return text;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("1")) {
|
|
||||||
return new NPCIDsToKillPrompt();
|
|
||||||
} else if (input.equalsIgnoreCase("2")) {
|
|
||||||
if (context.getSessionData(pref + "npcIdsToKill") == null) {
|
|
||||||
context.getForWhom().sendRawMessage(RED + "You must set NPC ids first!");
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
} else {
|
|
||||||
return new NPCAmountsToKillPrompt();
|
|
||||||
}
|
|
||||||
} else if (input.equalsIgnoreCase("3")) {
|
|
||||||
context.getForWhom().sendRawMessage(YELLOW + "Kill NPCs objective cleared.");
|
|
||||||
context.setSessionData(pref + "npcIdsToKill", null);
|
|
||||||
context.setSessionData(pref + "npcAmountsToKill", null);
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
} else if (input.equalsIgnoreCase("4")) {
|
|
||||||
|
|
||||||
int one;
|
|
||||||
int two;
|
|
||||||
|
|
||||||
if (context.getSessionData(pref + "npcIdsToKill") != null) {
|
|
||||||
one = ((List<Integer>) context.getSessionData(pref + "npcIdsToKill")).size();
|
|
||||||
} else {
|
|
||||||
one = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.getSessionData(pref + "npcAmountsToKill") != null) {
|
|
||||||
two = ((List<Integer>) context.getSessionData(pref + "npcAmountsToKill")).size();
|
|
||||||
} else {
|
|
||||||
two = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (one == two) {
|
|
||||||
|
|
||||||
return new CreateStagePrompt(stageNum, questFactory, citizens);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
context.getForWhom().sendRawMessage(RED + "The list sizes are not equal!");
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Integer> getNPCIds(ConversationContext context) {
|
|
||||||
return (List<Integer>) context.getSessionData(pref + "npcIdsToKill");
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Integer> getKillAmounts(ConversationContext context) {
|
|
||||||
return (List<Integer>) context.getSessionData(pref + "npcAmountsToKill");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class NPCIDsToKillPrompt extends StringPrompt {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext context) {
|
|
||||||
|
|
||||||
return YELLOW + "Enter NPC IDs, separating each one by a space, or enter \'cancel\' to return.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("cancel") == false) {
|
|
||||||
|
|
||||||
String[] args = input.split(" ");
|
|
||||||
LinkedList<Integer> npcs = new LinkedList<Integer>();
|
|
||||||
for (String s : args) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Integer i = Integer.parseInt(s);
|
|
||||||
|
|
||||||
if (citizens.getNPCRegistry().getById(i) != null) {
|
|
||||||
npcs.add(i);
|
|
||||||
} else {
|
|
||||||
context.getForWhom().sendRawMessage(PINK + "" + i + RED + " is not a valid NPC ID!");
|
|
||||||
return new NPCIDsToKillPrompt();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
|
|
||||||
return new NPCIDsToKillPrompt();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
context.setSessionData(pref + "npcIdsToKill", npcs);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class NPCAmountsToKillPrompt extends StringPrompt {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getPromptText(ConversationContext context) {
|
|
||||||
|
|
||||||
return YELLOW + "Enter kill amounts, separating each one by a space, or enter \'cancel\' to return.";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Prompt acceptInput(ConversationContext context, String input) {
|
|
||||||
|
|
||||||
if (input.equalsIgnoreCase("cancel") == false) {
|
|
||||||
|
|
||||||
String[] args = input.split(" ");
|
|
||||||
LinkedList<Integer> amounts = new LinkedList<Integer>();
|
|
||||||
for (String s : args) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
Integer i = Integer.parseInt(s);
|
|
||||||
amounts.add(i);
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
|
|
||||||
context.getForWhom().sendRawMessage(RED + "Invalid entry " + PINK + s + RED + ". Input was not a list of numbers!");
|
|
||||||
return new NPCAmountsToKillPrompt();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
context.setSessionData(pref + "npcAmountsToKill", amounts);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return new NPCKillListPrompt();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -165,9 +165,6 @@ public class StagesPrompt extends StringPrompt{
|
|||||||
|
|
||||||
cc.setSessionData(newPref + "shearColors", cc.getSessionData(pref + "shearColors"));
|
cc.setSessionData(newPref + "shearColors", cc.getSessionData(pref + "shearColors"));
|
||||||
cc.setSessionData(newPref + "shearAmounts", cc.getSessionData(pref + "shearAmounts"));
|
cc.setSessionData(newPref + "shearAmounts", cc.getSessionData(pref + "shearAmounts"));
|
||||||
|
|
||||||
cc.setSessionData(newPref + "npcIdsToKill", cc.getSessionData(pref + "npcIdsToKill"));
|
|
||||||
cc.setSessionData(newPref + "npcAmountsToKill", cc.getSessionData(pref + "npcAmountsToKill"));
|
|
||||||
|
|
||||||
cc.setSessionData(newPref + "event", cc.getSessionData(pref + "event"));
|
cc.setSessionData(newPref + "event", cc.getSessionData(pref + "event"));
|
||||||
|
|
||||||
@ -224,9 +221,6 @@ public class StagesPrompt extends StringPrompt{
|
|||||||
|
|
||||||
cc.setSessionData(pref + "shearColors", null);
|
cc.setSessionData(pref + "shearColors", null);
|
||||||
cc.setSessionData(pref + "shearAmounts", null);
|
cc.setSessionData(pref + "shearAmounts", null);
|
||||||
|
|
||||||
cc.setSessionData(pref + "npcIdsToKill", null);
|
|
||||||
cc.setSessionData(pref + "npcAmountsToKill", null);
|
|
||||||
|
|
||||||
cc.setSessionData(pref + "event", null);
|
cc.setSessionData(pref + "event", null);
|
||||||
|
|
||||||
|
@ -44,9 +44,6 @@ stage#tameAmounts
|
|||||||
stage#shearColors
|
stage#shearColors
|
||||||
stage#shearAmounts
|
stage#shearAmounts
|
||||||
|
|
||||||
stage#npcIdsToKill
|
|
||||||
stage#npcAmountsToKill
|
|
||||||
|
|
||||||
stage#event
|
stage#event
|
||||||
|
|
||||||
stage#delay
|
stage#delay
|
||||||
|
Loading…
Reference in New Issue
Block a user