first commit

This commit is contained in:
Blackvein 2012-10-09 14:41:59 -07:00
commit 11587a1ed5
44 changed files with 7147 additions and 0 deletions

74
build.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="Quests" default="default" basedir=".">
<description>Builds, tests, and runs the project Quests.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="Quests-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>

View File

@ -0,0 +1,4 @@
#Tue, 09 Oct 2012 14:20:18 -0700
C\:\\Users\\136-aclarke\\Desktop\\fwQuests=

10
build/classes/UPDATES Normal file
View File

@ -0,0 +1,10 @@
- Fixed quest-items not removing from player inventory
- Added event functionalities:
- clear-inventory: true/false Clear players inventory?
- item-ids: list of integers Item ids to give to the player
- item-amounts: list of integers Item amounts to give to the player
- Added quest item requirement
- remove-items: list of true/false Should the item requirements be removed from the players inventory?

29
build/classes/config.yml Normal file
View File

@ -0,0 +1,29 @@
# Quests config
#
#
# allow-command-questing: true/false
# Should we allow players to take Quests via commands?
#
# allow-command-quests-with-npcs: true/false
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
#
# show-requirements: true/false
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
#
# allow-quitting: true/false
# Should players be allowed to quit a Quest after they've taken it?
#
# debug-mode: true/false
# Should debugging information be printed out to console?
#
# kill-time: number
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
allow-command-questing: true
allow-command-quests-with-npcs: false
show-requirements: true
allow-quitting: true
debug-mode: false
kill-delay: 600

13
build/classes/events.yml Normal file
View File

@ -0,0 +1,13 @@
events:
ExampleEvent:
message: '<red>Event happened!'
potion-effect-types:
- Speed
- Jump
potion-effect-durations:
- 100
- 25
potion-effect-amplifiers:
- 3
- 2

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

68
build/classes/plugin.yml Normal file
View File

@ -0,0 +1,68 @@
name: Quests
main: me.blackvein.quests.Quests
version: 1.4
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: http://dev.bukkit.org/server-mods/quests/
authors: [Blackvein]
soft-depend: [Citizens, Questioner, Vault]
permissions:
quests.quest:
description: View current Quest objectives
default: true
quests.questinfo:
description: View information about a Quest
default: true
quests.quests:
description: View Quests help
default: true
quests.list:
description: List Quests
default: true
quests.take:
description: Accept a Quest via command
default: true
quests.quit:
description: Quit current Quest
default: true
quests.stats:
description: View Questing statistics
default: true
quests.top:
description: View Questing leaderboards
default: true
quests.info:
description: View plugin information
default: true
quests.admin:
description: Base Questsadmin command
default: op
quests.admin.give:
description: Force a player to take a Quest (Overrides requirements)
default: op
quests.admin.quit:
description: Force a player to quit their current Quest
default: op
quests.admin.points:
description: Set a players Quest Points
default: op
quests.admin.finish:
description: Immediately force Quest completion for a player
default: op
quests.admin.nextstage:
description: Immediately force Stage completion for a player
default: op
quests.admin.reload:
description: Reload all Quests
default: op
commands:
quests:
description: Quests command
permission: quests.quests
questadmin:
description: Quests admin command
permission: quests.admin
aliases: [questsadmin]
quest:
description: Quest command
permission: quests.quest

52
build/classes/quests.yml Normal file
View File

@ -0,0 +1,52 @@
quests:
Miner:
name: 'Stone Miner'
ask-message: '<yellow>Mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and retrieve <purple>10<yellow> pieces of <purple>Cobblestone<yellow>.'
finish-message: '<yellow>Well done. Here is your reward.'
requirements:
item-ids: [270]
item-amounts: [1]
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
stages:
ordered:
1:
break-block-ids: [1]
break-block-amounts: [10]
collect-item-ids: [4]
collect-item-amounts: [10]
quest-items: [true]
rewards:
money: 1000
quest-points: 1
Hunter:
name: 'Mob Hunter'
ask-message: '<yellow>Kill an assortment of Mobs.'
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
requirements:
quests: [Stone Miner]
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
stages:
ordered:
1:
mobs-to-kill: [Pig]
mob-amounts: [3]
finished: '<yellow>Now kill <purple>2 Zombies<yellow>.'
2:
mobs-to-kill: [Zombie]
mob-amounts: [2]
finished: '<yellow>Finally, kill <purple>1 Skeleton<yellow>.'
3:
mobs-to-kill: [Skeleton]
mob-amounts: [1]
rewards:
item-ids: [276]
item-amounts: [1]
exp: 100
quest-points: 1

BIN
lib/Heroes.jar Normal file

Binary file not shown.

BIN
lib/Questioner.jar Normal file

Binary file not shown.

BIN
lib/Vault.jar Normal file

Binary file not shown.

BIN
lib/bukkit-1.3.1-R2.0.jar Normal file

Binary file not shown.

BIN
lib/citizensapi-2.0.3.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/mcMMO.jar Normal file

Binary file not shown.

3
manifest.mf Normal file
View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build

10
src/UPDATES Normal file
View File

@ -0,0 +1,10 @@
- Fixed quest-items not removing from player inventory
- Added event functionalities:
- clear-inventory: true/false Clear players inventory?
- item-ids: list of integers Item ids to give to the player
- item-amounts: list of integers Item amounts to give to the player
- Added quest item requirement
- remove-items: list of true/false Should the item requirements be removed from the players inventory?

29
src/config.yml Normal file
View File

@ -0,0 +1,29 @@
# Quests config
#
#
# allow-command-questing: true/false
# Should we allow players to take Quests via commands?
#
# allow-command-quests-with-npcs: true/false
# Should we allow players to take Quests via commands, that have NPCs as quest starters?
#
# show-requirements: true/false
# Should players be told the exact requirements of a Quest when they look at its info (via command)?
#
# allow-quitting: true/false
# Should players be allowed to quit a Quest after they've taken it?
#
# debug-mode: true/false
# Should debugging information be printed out to console?
#
# kill-time: number
# How long (in seconds) should a player have to wait before they can kill the same player for a Quest?
allow-command-questing: true
allow-command-quests-with-npcs: false
show-requirements: true
allow-quitting: true
debug-mode: false
kill-delay: 600

13
src/events.yml Normal file
View File

@ -0,0 +1,13 @@
events:
ExampleEvent:
message: '<red>Event happened!'
potion-effect-types:
- Speed
- Jump
potion-effect-durations:
- 100
- 25
potion-effect-amplifiers:
- 3
- 2

View File

@ -0,0 +1,380 @@
package me.blackvein.quests;
import java.io.File;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
public class Event {
String name = "";
String message = null;
boolean clearInv = false;
LinkedList<Location> explosions = new LinkedList<Location>();
Map<Location, Effect> effects = new HashMap<Location, Effect>();
Map<Material, Integer> items = new EnumMap<Material, Integer>(Material.class);
World stormWorld = null;
int stormDuration = 0;
World thunderWorld = null;
int thunderDuration = 0;
LinkedList<Location> mobSpawnLocs = new LinkedList<Location>();
LinkedList<EntityType> mobSpawnTypes = new LinkedList<EntityType>();
LinkedList<Integer> mobSpawnAmounts = new LinkedList<Integer>();
LinkedList<Location> lightningStrikes = new LinkedList<Location>();
LinkedList<PotionEffect> potionEffects = new LinkedList<PotionEffect>();
int hunger = 0;
int saturation = 0;
int health = 0;
Location teleport;
@Override
public boolean equals(Object o){
if(o instanceof Event){
Event other = (Event) o;
if(other.name.equals(name) == false)
return false;
if(other.message != null && message != null){
if(other.message.equals(message) == false)
return false;
}else if(other.message != null && message == null){
return false;
}else if(other.message == null && message != null)
return false;
if(other.clearInv != clearInv)
return false;
if(other.explosions.equals(explosions) == false)
return false;
if(other.effects.entrySet().equals(effects.entrySet()) == false)
return false;
if(other.items.entrySet().equals(items.entrySet()) == false)
return false;
if(other.stormWorld != null && stormWorld != null){
if(other.stormWorld.equals(stormWorld) == false)
return false;
}else if(other.stormWorld != null && stormWorld == null){
return false;
}else if(other.stormWorld == null && stormWorld != null)
return false;
if(other.stormDuration != stormDuration)
return false;
if(other.thunderWorld != null && thunderWorld != null){
if(other.thunderWorld.equals(thunderWorld) == false)
return false;
}else if(other.thunderWorld != null && thunderWorld == null){
return false;
}else if(other.thunderWorld == null && thunderWorld != null)
return false;
if(other.thunderDuration != thunderDuration)
return false;
if(other.mobSpawnLocs.equals(mobSpawnLocs) == false)
return false;
if(other.mobSpawnTypes.equals(mobSpawnTypes) == false)
return false;
if(other.mobSpawnAmounts.equals(mobSpawnAmounts) == false)
return false;
if(other.lightningStrikes.equals(lightningStrikes) == false)
return false;
if(other.potionEffects.equals(potionEffects) == false)
return false;
if(other.hunger != hunger)
return false;
if(other.saturation != saturation)
return false;
if(other.health != health)
return false;
if(other.teleport != null && teleport != null){
if(other.teleport.equals(teleport) == false)
return false;
}else if(other.teleport != null && teleport == null){
return false;
}else if(other.teleport == null && teleport != null)
return false;
}
return true;
}
public void happen(Player player){
if(message.isEmpty() == false)
player.sendMessage(message);
if(clearInv == true){
player.getInventory().clear();
}
if(explosions.isEmpty() == false){
for(Location l : explosions){
l.getWorld().createExplosion(l, 4F, false);
}
}
if(effects.isEmpty() == false){
for(Location l : effects.keySet()){
l.getWorld().playEffect(l, effects.get(l), 1);
}
}
if(items.isEmpty() == false){
for(Material m : items.keySet())
Quests.addItem(player, new ItemStack(m, items.get(m)));
}
if(stormWorld != null){
stormWorld.setStorm(true);
stormWorld.setWeatherDuration(stormDuration);
}
if(thunderWorld != null){
thunderWorld.setThundering(true);
thunderWorld.setThunderDuration(thunderDuration);
}
if(mobSpawnLocs.isEmpty() == false){
for(Location l : mobSpawnLocs){
for(int i = 1; i <= mobSpawnAmounts.get(mobSpawnLocs.indexOf(l)); i++){
l.getWorld().spawnEntity(l, mobSpawnTypes.get(mobSpawnLocs.indexOf(l)));
}
}
}
if(lightningStrikes.isEmpty() == false){
for(Location l : lightningStrikes){
l.getWorld().strikeLightning(l);
}
}
if(potionEffects.isEmpty() == false){
for(PotionEffect p : potionEffects){
player.addPotionEffect(p);
}
}
if(hunger != 0){
player.setExhaustion(hunger);
}
if(saturation != 0){
player.setSaturation(saturation);
}
if(health != 0){
player.setHealth(health);
}
if(teleport != null){
player.teleport(teleport);
}
}
public static Event getEvent(String name, Quests plugin, Quest quest){
Event event = new Event();
FileConfiguration data = new YamlConfiguration();
try{
data.load(new File(plugin.getDataFolder(), "events.yml"));
}catch (Exception e){
e.printStackTrace();
}
String eventKey = "events." + name + ".";
event.name = name;
if(data.contains(eventKey + "message"))
event.message = plugin.parseString(data.getString(eventKey + "message"), quest);
if(data.contains(eventKey + "clear-inventory"))
event.clearInv = data.getBoolean(eventKey + "clear-inventory");
if(data.contains(eventKey + "explosions")){
for(String s : data.getStringList(eventKey + "explosions")){
Location loc = Quests.getLocation(s);
event.explosions.add(loc);
}
}
if(data.contains(eventKey + "effects")){
List<String> effectList = data.getStringList(eventKey + "effects");
List<String> effectLocs = data.getStringList(eventKey + "effect-locations");
for(String s : effectLocs)
event.effects.put(Quests.getLocation(s), Quests.getEffect(effectList.get(effectLocs.indexOf(s))));
}
if(data.contains(eventKey + "item-ids")){
List<Material> itemIds = new LinkedList<Material>();
for(Integer i : data.getIntegerList(eventKey + "item-ids"))
itemIds.add(Material.getMaterial(i));
List<Integer> itemAmounts = data.getIntegerList(eventKey + "item-amounts");
for(Material m : itemIds)
event.items.put(m, itemAmounts.get(itemIds.indexOf(m)));
}
if(data.contains(eventKey + "storm-world")){
event.stormDuration = data.getInt(eventKey + "storm-duration");
event.stormWorld = plugin.getServer().getWorld(data.getString(eventKey + "storm-world"));
}
if(data.contains(eventKey + "thunder-world")){
event.thunderDuration = data.getInt(eventKey + "thunder-duration");
event.thunderWorld = plugin.getServer().getWorld(data.getString(eventKey + "thunder-world"));
}
if(data.contains(eventKey + "mob-spawn-locations")){
List<String> mobLocs = data.getStringList(eventKey + "mob-spawn-locations");
List<String> mobTypes = data.getStringList(eventKey + "mob-spawn-types");
List<Integer> mobAmounts = data.getIntegerList(eventKey + "mob-spawn-amounts");
for(String s : mobLocs){
Location location = Quests.getLocation(s);
EntityType type = Quests.getMobType(mobTypes.get(mobLocs.indexOf(s)));
int amount = mobAmounts.get(mobLocs.indexOf(s));
event.mobSpawnLocs.add(location);
event.mobSpawnTypes.add(type);
event.mobSpawnAmounts.add(amount);
}
}
if(data.contains(eventKey + "lightning-strikes")){
for(String s : data.getStringList(eventKey + "lightning-strikes")){
Location loc = Quests.getLocation(s);
event.lightningStrikes.add(loc);
}
}
if(data.contains(eventKey + "potion-effect-types")){
List<String> types = data.getStringList(eventKey + "potion-effect-types");
List<Integer> durations = data.getIntegerList(eventKey + "potion-effect-durations");
List<Integer> amplifiers = data.getIntegerList(eventKey + "potion-effect-amplifiers");
for(String s : types){
PotionEffect effect = Quests.getPotionEffect(s, durations.get(types.indexOf(s)), amplifiers.get(types.indexOf(s)));
event.potionEffects.add(effect);
}
}
if(data.contains(eventKey + "hunger")){
event.hunger = data.getInt(eventKey + "hunger");
}
if(data.contains(eventKey + "saturation")){
event.saturation = data.getInt(eventKey + "saturation");
}
if(data.contains(eventKey + "health")){
event.health = data.getInt(eventKey + "health");
}
if(data.contains(eventKey + "teleport-location")){
event.teleport = Quests.getLocation(data.getString(eventKey + "teleport-location"));
}
return event;
}
}

View File

@ -0,0 +1,134 @@
package me.blackvein.quests;
import ca.xshade.questionmanager.Option;
import ca.xshade.questionmanager.Question;
import java.util.LinkedList;
import net.citizensnpcs.api.event.NPCRightClickEvent;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
public class NpcListener implements Listener{
Quests plugin;
public NpcListener(Quests newPlugin){
plugin = newPlugin;
}
@EventHandler
public void onNPCRightClick(NPCRightClickEvent evt){
if(plugin.questNPCs.contains(evt.getNPC())){
final Player player = evt.getClicker();
final NPC npc = evt.getNPC();
final Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("talkToNPC")){
quester.interactWithNPC(evt.getNPC());
}else {
for(final Quest q : plugin.quests){
if(q.npcStart != null && player.hasPermission("quests.quest")){
if(q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q) == false){
if(quester.currentQuest == null){
LinkedList<Option> options = new LinkedList<Option>();
Option yes = new Option("Yes", new Runnable(){
public void run(){
if(q.testRequirements(player) == true){
quester.currentQuest = q;
quester.currentStage = q.stages.getFirst();
quester.addEmpties();
quester.isTalking = false;
if(q.moneyReq > 0){
Quests.economy.withdrawPlayer(quester.name, q.moneyReq);
}
for(int i : q.itemIds){
if (q.removeItems.get(i) == true)
Quests.removeItem(player, new ItemStack(Material.getMaterial(i), q.itemAmounts.get(q.itemIds.indexOf(i))));
}
player.sendMessage(ChatColor.GREEN + "Quest accepted: " + q.name);
player.sendMessage("");
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : quester.getObjectives()){
player.sendMessage(s);
}
}else {
player.sendMessage(npc.getName() + ": " + q.failRequirements);
quester.isTalking = false;
}
}
});
Option no = new Option("No", new Runnable(){
public void run(){
quester.isTalking = false;
player.sendMessage(ChatColor.YELLOW + "Cancelled.");
}
});
options.add(yes);
options.add(no);
if(quester.isTalking == false){
quester.isTalking = true;
Question question = new Question(player.getName(), "Accept quest?", options);
plugin.questioner.getQuestionManager().newQuestion(question);
player.sendMessage(ChatColor.GOLD + "- " + q.name + " -");
player.sendMessage(npc.getName() + ": " + q.description);
try{
plugin.questioner.appendQuestion(question);
}catch (Exception e){
e.printStackTrace();
}
}
}else {
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}
break;
}
}
}
}
}
}
}

View File

@ -0,0 +1,495 @@
package me.blackvein.quests;
import ca.xshade.questionmanager.Option;
import ca.xshade.questionmanager.Question;
import java.io.File;
import java.util.LinkedList;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.EntityTameEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.CraftItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.*;
public class PlayerListener implements Listener {
Quests plugin;
public PlayerListener(Quests newPlugin) {
plugin = newPlugin;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent evt){
if(evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
final Quester quester = plugin.getQuester(evt.getPlayer().getName());
final Player player = evt.getPlayer();
if(quester.hasObjective("useBlock")){
quester.useBlock(evt.getClickedBlock().getType());
}else {
for(final Quest q : plugin.quests){
if(q.blockStart != null){
if(q.blockStart.equals(evt.getClickedBlock().getLocation())){
if(quester.currentQuest != null){
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
}else {
LinkedList<Option> options = new LinkedList<Option>();
Option yes = new Option("Yes", new Runnable(){
public void run(){
if(q.testRequirements(player) == true){
quester.currentQuest = q;
quester.currentStage = q.stages.getFirst();
quester.addEmpties();
quester.isTalking = false;
if(q.moneyReq > 0){
Quests.economy.withdrawPlayer(quester.name, q.moneyReq);
}
player.sendMessage(ChatColor.GREEN + "Quest accepted: " + q.name);
player.sendMessage("");
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : quester.getObjectives()){
player.sendMessage(s);
}
}else {
player.sendMessage(q.failRequirements);
quester.isTalking = false;
}
}
});
Option no = new Option("No", new Runnable(){
public void run(){
quester.isTalking = false;
player.sendMessage(ChatColor.YELLOW + "Cancelled.");
}
});
options.add(yes);
options.add(no);
if(quester.isTalking == false){
quester.isTalking = true;
Question question = new Question(player.getName(), "Accept quest?", options);
plugin.questioner.getQuestionManager().newQuestion(question);
player.sendMessage(ChatColor.GOLD + "- " + q.name + " -");
player.sendMessage(q.description);
try{
plugin.questioner.appendQuestion(question);
}catch (Exception e){
e.printStackTrace();
}
}
}
}
}
}
}
}
}
@EventHandler
public void onBlockDamage(BlockDamageEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("damageBlock")){
quester.damageBlock(evt.getBlock().getType());
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onBlockPlace(BlockPlaceEvent evt){
if(evt.getPlayer().getName().toLowerCase().contains("_computercraft_") == false && evt.getPlayer().getName().toLowerCase().contains("_buildcraft_") == false && evt.getPlayer().getName().toLowerCase().contains("_redpower_") == false && evt.getPlayer().getName().toLowerCase().contains("_buildcraft_") == false && evt.getPlayer().getName().toLowerCase().contains("(buildcraft)") == false){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("placeBlock")){
if(evt.isCancelled() == false)
quester.placeBlock(evt.getBlock().getType());
}
}
}
@EventHandler (priority = EventPriority.HIGHEST)
public void onBlockBreak(BlockBreakEvent evt){
boolean canOpen = true;
if(evt.getBlock().getType().equals(Material.BREWING_STAND) && plugin.allowOtherBrewing == false && evt.getPlayer().getName().contains("_computercraft_") == false && evt.getPlayer().getName().contains("_buildcraft_") == false && evt.getPlayer().getName().contains("_redpower_") == false){
if(plugin.brewers.containsKey(evt.getBlock().getLocation())){
if(evt.getPlayer().getName().equalsIgnoreCase(plugin.brewers.get(evt.getBlock().getLocation())) == false){
evt.getPlayer().sendMessage(ChatColor.RED + "You may not break other players' Brewing Stands.");
evt.setCancelled(true);
canOpen = false;
}
}
}
if(canOpen == true){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("breakBlock")){
if(evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false)
quester.breakBlock(evt.getBlock().getType());
}
if(quester.hasObjective("placeBlock")){
if(quester.blocksPlaced.containsKey(evt.getBlock().getType())){
if(quester.blocksPlaced.get(evt.getBlock().getType()) > 0){
if(evt.isCancelled() == false)
quester.blocksPlaced.put(evt.getBlock().getType(), quester.blocksPlaced.get(evt.getBlock().getType()) - 1);
}
}
}
if(evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective("cutBlock")){
quester.cutBlock(evt.getBlock().getType());
}
}
}
@EventHandler
public void onPlayerPickupItem(PlayerPickupItemEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("collectItem")){
quester.collectItem(evt.getItem().getItemStack());
}
}
@EventHandler
public void onPlayerShearEntity(PlayerShearEntityEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective("shearSheep")){
Sheep sheep = (Sheep) evt.getEntity();
quester.shearSheep(sheep.getColor());
}
}
@EventHandler
public void onEntityTame(EntityTameEvent evt){
if(evt.getOwner() instanceof Player){
Player p = (Player) evt.getOwner();
Quester quester = plugin.getQuester(p.getName());
if(quester.hasObjective("tameMob")){
quester.tameMob(evt.getEntityType());
}
}
}
@EventHandler
public void onEnchantItem(EnchantItemEvent evt){
Quester quester = plugin.getQuester(evt.getEnchanter().getName());
if(quester.hasObjective("enchantItem")){
for(Enchantment e : evt.getEnchantsToAdd().keySet()){
quester.enchantItem(e, evt.getItem().getType());
}
}
}
@EventHandler
public void onCraftItem(CraftItemEvent evt){
if(evt.getWhoClicked() instanceof Player){
Player p = (Player) evt.getWhoClicked();
Quester quester = plugin.getQuester(p.getName());
if(quester.hasObjective("craftItem")){
quester.craftItem(evt.getCurrentItem());
}
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent evt){
if(evt.getWhoClicked() instanceof Player && evt.getCursor() != null){
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
if(quester.currentQuest != null){
if(quester.currentQuest.questItems.containsKey(evt.getCursor().getType())){
if(evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() > 52){
quester.collectItem(evt.getCursor());
}
}
}
}
if(evt.getWhoClicked() instanceof Player && evt.getCurrentItem() != null){
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
if(quester.currentQuest != null){
if(quester.currentQuest.questItems.containsKey(evt.getCurrentItem().getType())){
if(evt.getInventory().getType().equals(InventoryType.CHEST) == false || evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() > 52){
((Player) evt.getWhoClicked()).sendMessage(ChatColor.YELLOW + "You may not modify Quest items in your inventory.");
evt.setCancelled(true);
}else if(evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() < 53)
quester.collectItem(evt.getCurrentItem());
}
}
}
}
@EventHandler
public void onEntityDeath(EntityDeathEvent evt){
if(evt.getEntity() instanceof Player == false){
if(evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent){
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
Entity damager = damageEvent.getDamager();
if(damager != null){
if(damager instanceof Projectile){
Projectile p = (Projectile) damager;
if(p.getShooter() instanceof Player){
try{
Player player = (Player) p.getShooter();
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killMob"))
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}catch(Exception e){
//Do nothing, killer is an NPC
}
}
}else if(damager instanceof Player){
try{
Player player = (Player) damager;
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killMob"))
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
}catch (Exception e){
//Do nothing, killer is an NPC
}
}
}
}
}
}
@EventHandler
public void onPlayerDeath(PlayerDeathEvent evt){
if(evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent){
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
Entity damager = damageEvent.getDamager();
if(damager != null){
if(damager instanceof Projectile){
Projectile p = (Projectile) damager;
if(p.getShooter() instanceof Player){
Player player = (Player) p.getShooter();
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killPlayer"))
quester.killPlayer(evt.getEntity().getName());
}
}else if(damager instanceof Player){
Player player = (Player) damager;
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("killPlayer"))
quester.killPlayer(evt.getEntity().getName());
}
}
}
}
@EventHandler
public void onPlayerFish(PlayerFishEvent evt){
Player player = evt.getPlayer();
Quester quester = plugin.getQuester(player.getName());
if(quester.hasObjective("catchFish") && evt.getState().equals(State.CAUGHT_FISH))
quester.catchFish();
}
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.currentQuest != null){
if(quester.currentQuest.questItems.containsKey(evt.getItemDrop().getItemStack().getType())){
evt.getPlayer().sendMessage(ChatColor.YELLOW + "You may not discard Quest items.");
evt.setCancelled(true);
}
}
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent evt){
Quester quester = new Quester(plugin);
quester.name = evt.getPlayer().getName();
if(new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()){
quester.loadData();
}else {
quester.saveData();
}
plugin.questers.add(quester);
for(Quest q : quester.completedQuests){
if(quester.completedTimes.containsKey(q) == false && q.redoDelay > -1)
quester.completedTimes.put(q, System.currentTimeMillis());
}
quester.checkQuest();
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
quester.saveData();
plugin.questers.remove(quester);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent evt){
Quester quester = plugin.getQuester(evt.getPlayer().getName());
if(quester.hasObjective("reachLocation")){
quester.reachLocation(evt.getTo());
}
}
}

View File

@ -0,0 +1,394 @@
package me.blackvein.quests;
import com.herocraftonline.heroes.characters.classes.HeroClass.ExperienceType;
import java.util.EnumMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class Quest {
String name;
String description;
String finished;
int redoDelay = -1;
LinkedList<Stage> stages = new LinkedList<Stage>();
NPC npcStart;
Location blockStart;
Quests plugin;
Map<Material, Integer> questItems = new EnumMap<Material, Integer>(Material.class);
//Requirements
int moneyReq = 0;
int questPointsReq = 0;
List<Integer> itemIds = new LinkedList<Integer>();
List<Integer> itemAmounts = new LinkedList<Integer>();
List<Boolean> removeItems = new LinkedList<Boolean>();
List<Quest> neededQuests = new LinkedList<Quest>();
List<String> permissionReqs = new LinkedList<String>();
String failRequirements;
//
//Rewards
int moneyReward = 0;
int questPoints = 0;
int exp = 0;
List<String> commands = new LinkedList<String>();
List<String> permissions = new LinkedList<String>();
LinkedList<ItemStack> itemRewards = new LinkedList<ItemStack>();
//Heroes
int heroesExp = 0;
String heroesClass = null;
String heroesSecClass = null;
//
//mcMMO
List<String> mcmmoSkills = new LinkedList<String>();
List<Integer> mcmmoAmounts = new LinkedList<Integer>();
//
//
public void nextStage(Quester q){
Player player = plugin.getServer().getPlayerExact(q.name);
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(player);
completeQuest(q);
}else {
q.reset();
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
if(q.currentStage.script != null)
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
if(q.currentStage.event != null)
q.currentStage.event.happen(player);
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
q.addEmpties();
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
for(String s : q.getObjectives()){
player.sendMessage(s);
}
}
}
public boolean testRequirements(Player player){
Quester quester = plugin.getQuester(player.getName());
if(moneyReq != 0 && Quests.economy.getBalance(player.getName()) < moneyReq)
return false;
PlayerInventory inventory = player.getInventory();
int num = 0;
for(int i : itemIds){
for(ItemStack stack : inventory.getContents()){
if(stack != null){
if(i == stack.getTypeId())
num += stack.getAmount();
}
}
if(num < itemAmounts.get(itemIds.indexOf(i)))
return false;
num = 0;
}
for(String s : permissionReqs){
if(player.hasPermission(s) == false)
return false;
}
if(quester.questPoints < questPointsReq)
return false;
if(quester.completedQuests.containsAll(neededQuests) == false)
return false;
return true;
}
public void completeQuest(Quester q){
Player player = plugin.getServer().getPlayerExact(q.name);
q.reset();
q.completedQuests.add(this);
String none = ChatColor.GRAY + "- (None)";
player.sendMessage(plugin.parseString(finished, q.currentQuest));
Quests.economy.depositPlayer(q.name, moneyReward);
if(redoDelay > -1)
q.completedTimes.put(this, System.currentTimeMillis());
for(ItemStack i : itemRewards){
Quests.addItem(player, i);
}
for(Entry entry : questItems.entrySet()){
Material material = (Material) entry.getKey();
int amount = (Integer) entry.getValue();
for(ItemStack stack : player.getInventory().getContents()){
if(stack != null){
if(stack.getType().equals(material)){
if(stack.getAmount() > amount){
stack.setAmount(stack.getAmount() - amount);
break;
}else{
amount -= stack.getAmount();
stack.setAmount(0);
if(amount == 0)
break;
}
}
}
}
}
for(String s : commands){
s = s.replaceAll("<player>", player.getName());
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
}
for(String s : permissions){
Quests.permission.playerAdd(player, s);
none = null;
}
for(String s : mcmmoSkills){
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
}
if(exp > 0)
player.giveExp(exp);
if(heroesExp > 0)
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
if(heroesClass != null)
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
if(heroesSecClass != null)
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
player.sendMessage(ChatColor.GOLD + "**QUEST COMPLETE: " + ChatColor.YELLOW + q.currentQuest.name + ChatColor.GOLD + "**");
player.sendMessage(ChatColor.GREEN + "Rewards:");
if(questPoints > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + questPoints + " Quest Points");
none = null;
}
q.questPoints += questPoints;
for(ItemStack i : itemRewards){
player.sendMessage("- " + ChatColor.DARK_GREEN + Quester.prettyItemString(i.getTypeId()) + ChatColor.GRAY + " x " + i.getAmount());
none = null;
}
if(moneyReward > 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNamePlural());
none = null;
}else if(moneyReward == 1){
player.sendMessage("- " + ChatColor.DARK_GREEN + moneyReward + " " + ChatColor.DARK_PURPLE + Quests.economy.currencyNameSingular());
none = null;
}
if(exp > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + exp + ChatColor.DARK_PURPLE + " Experience");
none = null;
}
if(heroesExp > 0){
player.sendMessage("- " + ChatColor.DARK_GREEN + heroesExp + ChatColor.DARK_PURPLE + " Heroes Exp");
none = null;
}
if(heroesClass != null){
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesClass + ChatColor.AQUA + " Heroes Class");
none = null;
}
if(heroesSecClass != null){
player.sendMessage("- " + ChatColor.DARK_PURPLE + heroesSecClass + ChatColor.AQUA + " Heroes Secondary Class");
none = null;
}
if(none != null){
player.sendMessage(none);
}
q.currentQuest = null;
q.currentStage = null;
q.saveData();
}
@Override
public boolean equals(Object o){
if(o instanceof Quest){
Quest other = (Quest) o;
if(other.blockStart != null && blockStart != null){
if(other.blockStart.equals(blockStart) == false)
return false;
}else if(other.blockStart != null && blockStart == null){
return false;
}else if(other.blockStart == null && blockStart != null)
return false;
for(String s : other.commands){
if(commands.get(other.commands.indexOf(s)).equals(s) == false)
return false;
}
if(other.description.equals(description) == false)
return false;
if(other.exp != exp)
return false;
if(other.failRequirements != null && failRequirements != null){
if(other.failRequirements.equals(failRequirements) == false)
return false;
}else if(other.failRequirements != null && failRequirements == null){
return false;
}else if(other.failRequirements == null && failRequirements != null)
return false;
if(other.finished.equals(finished) == false)
return false;
if(other.heroesClass != null && heroesClass != null){
if(other.heroesClass.equals(heroesClass) == false)
return false;
}else if(other.heroesClass != null && heroesClass == null){
return false;
}else if(other.heroesClass == null && heroesClass != null)
return false;
if(other.heroesExp != heroesExp)
return false;
if(other.heroesSecClass != null && heroesSecClass != null){
if(other.heroesSecClass.equals(heroesSecClass) == false)
return false;
}else if(other.heroesSecClass != null && heroesSecClass == null){
return false;
}else if(other.heroesSecClass == null && heroesSecClass != null)
return false;
if(other.itemAmounts.equals(itemAmounts) == false)
return false;
if(other.itemIds.equals(itemIds) == false)
return false;
if(other.itemRewards.equals(itemRewards) == false)
return false;
if(other.mcmmoAmounts.equals(mcmmoAmounts) == false)
return false;
if(other.mcmmoSkills.equals(mcmmoSkills) == false)
return false;
if(other.moneyReq != moneyReq)
return false;
if(other.moneyReward != moneyReward)
return false;
if(other.name.equals(name) == false)
return false;
if(other.neededQuests.equals(neededQuests) == false)
return false;
if(other.npcStart != null && npcStart != null){
if(other.npcStart.equals(npcStart) == false)
return false;
}else if(other.npcStart != null && npcStart == null){
return false;
}else if(other.npcStart == null && npcStart != null)
return false;
if(other.permissionReqs.equals(permissionReqs) == false)
return false;
if(other.permissions.equals(permissions) == false)
return false;
if(other.questItems.equals(questItems) == false)
return false;
if(other.questPoints != questPoints)
return false;
if(other.questPointsReq != questPointsReq)
if(other.redoDelay != redoDelay)
return false;
if(other.stages.equals(stages) == false)
return false;
}
return true;
}
}

View File

@ -0,0 +1,30 @@
package me.blackvein.quests;
import java.util.List;
import net.aufdemrand.denizen.scripts.ScriptHelper;
import net.aufdemrand.denizen.scripts.ScriptEngine.QueueType;
import net.aufdemrand.denizen.triggers.AbstractTrigger;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class QuestTaskTrigger extends AbstractTrigger {
public boolean parseQuestTaskTrigger(String theScriptName, Player thePlayer) {
CommandSender cs = Bukkit.getConsoleSender();
ScriptHelper sE = plugin.getScriptEngine().helper;
if (theScriptName == null) return false;
List<String> theScript = sE.getScript(theScriptName + ".Script");
if (theScript.isEmpty()) return false;
sE.queueScriptEntries(thePlayer, sE.buildScriptEntries(thePlayer, theScript, theScriptName), QueueType.TASK);
return true;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,173 @@
package me.blackvein.quests;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.DyeColor;
import org.bukkit.World;
public class Stage {
public String finished;
Map<Material, Integer> blocksToDamage = new HashMap<Material, Integer>();
Map<Material, Integer> blocksToBreak = new HashMap<Material, Integer>();
Map<Material, Integer> blocksToPlace = new HashMap<Material, Integer>();
Map<Map<Material, Integer>, Boolean> itemsToCollect = new HashMap<Map<Material, Integer>, Boolean>();
Map<Material, Integer> blocksToUse = new HashMap<Material, Integer>();
Map<Material, Integer> blocksToCut = new HashMap<Material, Integer>();
Integer fishToCatch;
Integer playersToKill;
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
LinkedList<String> areaNames = new LinkedList<String>();
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>();
LinkedList<Location> locationsToReach = new LinkedList<Location>();
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
LinkedList<String> locationNames = new LinkedList<String>();
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
Map<Material, Integer> itemsToCraft = new EnumMap<Material, Integer>(Material.class);
String script;
Event event;
@Override
public boolean equals(Object o){
if(o instanceof Stage){
Stage other = (Stage) o;
if(other.finished != null && finished != null){
if(other.finished.equals(finished) == false)
return false;
}else if(other.finished != null && finished == null){
return false;
}else if(other.finished == null && finished != null)
return false;
if(other.blocksToDamage.equals(blocksToDamage) == false)
return false;
if(other.blocksToBreak.equals(blocksToBreak) == false)
return false;
if(other.blocksToPlace.equals(blocksToPlace) == false)
return false;
if(other.itemsToCollect.equals(itemsToCollect) == false)
return false;
if(other.blocksToUse.equals(blocksToUse) == false)
return false;
if(other.blocksToCut.equals(blocksToCut) == false)
return false;
if(other.fishToCatch != null && fishToCatch != null){
if(other.fishToCatch.equals(fishToCatch) == false)
return false;
}else if(other.fishToCatch != null && fishToCatch == null){
return false;
}else if(other.fishToCatch == null && fishToCatch != null)
return false;
if(other.playersToKill != null && playersToKill != null){
if(other.playersToKill.equals(playersToKill) == false)
return false;
}else if(other.playersToKill != null && playersToKill == null){
return false;
}else if(other.playersToKill == null && playersToKill != null)
return false;
if(other.itemsToEnchant.equals(itemsToEnchant) == false)
return false;
if(other.mobsToKill.equals(mobsToKill) == false)
return false;
if(other.mobNumToKill.equals(mobNumToKill) == false)
return false;
if(other.locationsToKillWithin.equals(locationsToKillWithin) == false)
return false;
if(other.radiiToKillWithin.equals(radiiToKillWithin) == false)
return false;
if(other.areaNames.equals(areaNames) == false)
return false;
if(other.citizensToInteract.equals(citizensToInteract) == false)
return false;
if(other.locationsToReach.equals(locationsToReach) == false)
return false;
if(other.radiiToReachWithin.equals(radiiToReachWithin) == false)
return false;
if(other.worldsToReachWithin.equals(worldsToReachWithin) == false)
return false;
if(other.locationNames.equals(locationNames) == false)
return false;
if(other.mobsToTame.equals(mobsToTame) == false)
return false;
if(other.sheepToShear.equals(sheepToShear) == false)
return false;
if(other.itemsToCraft.equals(itemsToCraft) == false)
return false;
if(other.script != null && script != null){
if(other.script.equals(script) == false)
return false;
}else if(other.script != null && script == null){
return false;
}else if(other.script == null && script != null)
return false;
if(other.event != null && event != null){
if(other.event.equals(event) == false)
return false;
}else if(other.event != null && event == null){
return false;
}else if(other.event == null && event != null)
return false;
}
return true;
}
}

68
src/plugin.yml Normal file
View File

@ -0,0 +1,68 @@
name: Quests
main: me.blackvein.quests.Quests
version: 1.4
description: Player questing system
website: http://dev.bukkit.org/server-mods/quests/
dev-url: http://dev.bukkit.org/server-mods/quests/
authors: [Blackvein]
soft-depend: [Citizens, Questioner, Vault]
permissions:
quests.quest:
description: View current Quest objectives
default: true
quests.questinfo:
description: View information about a Quest
default: true
quests.quests:
description: View Quests help
default: true
quests.list:
description: List Quests
default: true
quests.take:
description: Accept a Quest via command
default: true
quests.quit:
description: Quit current Quest
default: true
quests.stats:
description: View Questing statistics
default: true
quests.top:
description: View Questing leaderboards
default: true
quests.info:
description: View plugin information
default: true
quests.admin:
description: Base Questsadmin command
default: op
quests.admin.give:
description: Force a player to take a Quest (Overrides requirements)
default: op
quests.admin.quit:
description: Force a player to quit their current Quest
default: op
quests.admin.points:
description: Set a players Quest Points
default: op
quests.admin.finish:
description: Immediately force Quest completion for a player
default: op
quests.admin.nextstage:
description: Immediately force Stage completion for a player
default: op
quests.admin.reload:
description: Reload all Quests
default: op
commands:
quests:
description: Quests command
permission: quests.quests
questadmin:
description: Quests admin command
permission: quests.admin
aliases: [questsadmin]
quest:
description: Quest command
permission: quests.quest

52
src/quests.yml Normal file
View File

@ -0,0 +1,52 @@
quests:
Miner:
name: 'Stone Miner'
ask-message: '<yellow>Mine <purple>10<yellow> blocks of <purple>Stone<yellow>, and retrieve <purple>10<yellow> pieces of <purple>Cobblestone<yellow>.'
finish-message: '<yellow>Well done. Here is your reward.'
requirements:
item-ids: [270]
item-amounts: [1]
fail-requirement-message: '<red>You must have a <purple>Wooden Pickaxe<red> first.'
stages:
ordered:
1:
break-block-ids: [1]
break-block-amounts: [10]
collect-item-ids: [4]
collect-item-amounts: [10]
quest-items: [true]
rewards:
money: 1000
quest-points: 1
Hunter:
name: 'Mob Hunter'
ask-message: '<yellow>Kill an assortment of Mobs.'
finish-message: '<yellow>Excellent. Here is a <purple>Diamond Sword<yellow>.'
requirements:
quests: [Stone Miner]
fail-requirement-message: '<red>Complete <purple>Stone Miner<red> first.'
stages:
ordered:
1:
mobs-to-kill: [Pig]
mob-amounts: [3]
finished: '<yellow>Now kill <purple>2 Zombies<yellow>.'
2:
mobs-to-kill: [Zombie]
mob-amounts: [2]
finished: '<yellow>Finally, kill <purple>1 Skeleton<yellow>.'
3:
mobs-to-kill: [Skeleton]
mob-amounts: [1]
rewards:
item-ids: [276]
item-amounts: [1]
exp: 100
quest-points: 1