mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-25 12:15:59 +01:00
Unstable
This commit is contained in:
parent
9a3ae8c2c0
commit
ed4472a5b3
@ -2,7 +2,6 @@ package me.blackvein.quests;
|
|||||||
|
|
||||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.conversations.Conversable;
|
import org.bukkit.conversations.Conversable;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -10,55 +9,84 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public class NpcListener implements Listener{
|
public class NpcListener implements Listener {
|
||||||
|
|
||||||
Quests plugin;
|
Quests plugin;
|
||||||
|
|
||||||
public NpcListener(Quests newPlugin){
|
public NpcListener(Quests newPlugin) {
|
||||||
|
|
||||||
plugin = newPlugin;
|
plugin = newPlugin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void onNPCRightClick(NPCRightClickEvent evt){
|
public void onNPCRightClick(NPCRightClickEvent evt) {
|
||||||
|
|
||||||
if(plugin.questNPCs.contains(evt.getNPC())){
|
if (plugin.questNPCs.contains(evt.getNPC())) {
|
||||||
|
|
||||||
final Player player = evt.getClicker();
|
final Player player = evt.getClicker();
|
||||||
final NPC npc = evt.getNPC();
|
|
||||||
|
|
||||||
final Quester quester = plugin.getQuester(player.getName());
|
final Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("talkToNPC")){
|
if (quester.hasObjective("talkToNPC")) {
|
||||||
|
|
||||||
quester.interactWithNPC(evt.getNPC());
|
quester.interactWithNPC(evt.getNPC());
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
for(final Quest q : plugin.quests){
|
for (final Quest q : plugin.quests) {
|
||||||
|
|
||||||
if(q.npcStart != null && player.hasPermission("quests.quest")){
|
if (q.npcStart != null && player.hasPermission("quests.quest")) {
|
||||||
|
|
||||||
if(q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false){
|
if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == false) {
|
||||||
|
|
||||||
if(quester.currentQuest == null){
|
if (quester.currentQuest == null) {
|
||||||
|
|
||||||
quester.questToTake = q.name;
|
quester.questToTake = q.name;
|
||||||
|
|
||||||
String s =
|
|
||||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
|
||||||
+ "\n"
|
|
||||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
|
||||||
player.sendMessage(s);
|
|
||||||
plugin.conversationFactory.buildConversation((Conversable)player).begin();
|
|
||||||
|
|
||||||
}else {
|
String s =
|
||||||
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
|
+ "\n"
|
||||||
|
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
|
player.sendMessage(s);
|
||||||
|
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||||
|
|
||||||
|
} else if (quester.currentQuest.equals(q) == false) {
|
||||||
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
} else if (q.npcStart.equals(evt.getNPC()) && quester.completedQuests.contains(q.name) == true) {
|
||||||
|
|
||||||
|
if (quester.currentQuest == null) {
|
||||||
|
|
||||||
|
if (quester.getDifference(q) > 0) {
|
||||||
|
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 {
|
||||||
|
|
||||||
|
quester.questToTake = q.name;
|
||||||
|
|
||||||
|
String s =
|
||||||
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
|
+ "\n"
|
||||||
|
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
|
player.sendMessage(s);
|
||||||
|
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (quester.currentQuest.equals(q) == false) {
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -70,14 +98,8 @@ public class NpcListener implements Listener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onNPCDespawn(NPCDespawnEvent evt){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onNPCDespawn(NPCDespawnEvent evt) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,60 +35,72 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent evt){
|
public void onPlayerInteract(PlayerInteractEvent evt) {
|
||||||
|
|
||||||
if(evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)){
|
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
|
|
||||||
final Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
final Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
final Player player = evt.getPlayer();
|
final Player player = evt.getPlayer();
|
||||||
|
|
||||||
if(quester.hasObjective("useBlock")){
|
if (quester.hasObjective("useBlock")) {
|
||||||
|
|
||||||
quester.useBlock(evt.getClickedBlock().getType());
|
quester.useBlock(evt.getClickedBlock().getType());
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
for(final Quest q : plugin.quests){
|
for (final Quest q : plugin.quests) {
|
||||||
|
|
||||||
if(q.blockStart != null){
|
if (q.blockStart != null) {
|
||||||
|
|
||||||
if(q.blockStart.equals(evt.getClickedBlock().getLocation())){
|
if (q.blockStart.equals(evt.getClickedBlock().getLocation())) {
|
||||||
|
|
||||||
if(quester.currentQuest != null){
|
if (quester.currentQuest != null) {
|
||||||
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
player.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
|
|
||||||
quester.questToTake = q.name;
|
if (quester.completedQuests.contains(q.name)) {
|
||||||
|
|
||||||
String s =
|
if (q.redoDelay < 0 || q.redoDelay > -1 && (quester.getDifference(q)) > 0) {
|
||||||
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
|
||||||
+ "\n"
|
|
||||||
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
|
||||||
|
|
||||||
player.sendMessage(s);
|
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 + ".");
|
||||||
plugin.conversationFactory.buildConversation((Conversable)player).begin();
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quester.questToTake = q.name;
|
||||||
|
|
||||||
|
String s =
|
||||||
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
|
+ "\n"
|
||||||
|
+ ChatColor.RESET + plugin.getQuest(quester.questToTake).description + "\n";
|
||||||
|
|
||||||
|
player.sendMessage(s);
|
||||||
|
plugin.conversationFactory.buildConversation((Conversable) player).begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockDamage(BlockDamageEvent evt){
|
public void onBlockDamage(BlockDamageEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if(quester.hasObjective("damageBlock")){
|
if (quester.hasObjective("damageBlock")) {
|
||||||
|
|
||||||
quester.damageBlock(evt.getBlock().getType());
|
quester.damageBlock(evt.getBlock().getType());
|
||||||
|
|
||||||
@ -96,16 +108,17 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockPlace(BlockPlaceEvent evt){
|
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){
|
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());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if(quester.hasObjective("placeBlock")){
|
if (quester.hasObjective("placeBlock")) {
|
||||||
|
|
||||||
if(evt.isCancelled() == false)
|
if (evt.isCancelled() == false) {
|
||||||
quester.placeBlock(evt.getBlock().getType());
|
quester.placeBlock(evt.getBlock().getType());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,51 +126,53 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler (priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onBlockBreak(BlockBreakEvent evt){
|
public void onBlockBreak(BlockBreakEvent evt) {
|
||||||
|
|
||||||
boolean canOpen = true;
|
boolean canOpen = true;
|
||||||
|
|
||||||
if(canOpen == true){
|
if (canOpen == true) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if(quester.hasObjective("breakBlock")){
|
if (quester.hasObjective("breakBlock")) {
|
||||||
|
|
||||||
if(evt.getPlayer().getItemInHand().containsEnchantment(Enchantment.SILK_TOUCH) == false && evt.isCancelled() == false)
|
|
||||||
quester.breakBlock(evt.getBlock().getType());
|
|
||||||
|
|
||||||
|
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.hasObjective("placeBlock")) {
|
||||||
|
|
||||||
if(quester.blocksPlaced.get(evt.getBlock().getType()) > 0){
|
if (quester.blocksPlaced.containsKey(evt.getBlock().getType())) {
|
||||||
|
|
||||||
if(evt.isCancelled() == false)
|
if (quester.blocksPlaced.get(evt.getBlock().getType()) > 0) {
|
||||||
quester.blocksPlaced.put(evt.getBlock().getType(), quester.blocksPlaced.get(evt.getBlock().getType()) - 1);
|
|
||||||
|
|
||||||
|
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());
|
if (evt.getPlayer().getItemInHand().getType().equals(Material.SHEARS) && quester.hasObjective("cutBlock")) {
|
||||||
|
|
||||||
}
|
quester.cutBlock(evt.getBlock().getType());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerPickupItem(PlayerPickupItemEvent evt){
|
public void onPlayerPickupItem(PlayerPickupItemEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if(quester.hasObjective("collectItem")){
|
if (quester.hasObjective("collectItem")) {
|
||||||
|
|
||||||
quester.collectItem(evt.getItem().getItemStack());
|
quester.collectItem(evt.getItem().getItemStack());
|
||||||
|
|
||||||
@ -166,10 +181,10 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerShearEntity(PlayerShearEntityEvent evt){
|
public void onPlayerShearEntity(PlayerShearEntityEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if(evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective("shearSheep")){
|
if (evt.getEntity().getType().equals(EntityType.SHEEP) && quester.hasObjective("shearSheep")) {
|
||||||
|
|
||||||
Sheep sheep = (Sheep) evt.getEntity();
|
Sheep sheep = (Sheep) evt.getEntity();
|
||||||
quester.shearSheep(sheep.getColor());
|
quester.shearSheep(sheep.getColor());
|
||||||
@ -179,13 +194,13 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEntityTame(EntityTameEvent evt){
|
public void onEntityTame(EntityTameEvent evt) {
|
||||||
|
|
||||||
if(evt.getOwner() instanceof Player){
|
if (evt.getOwner() instanceof Player) {
|
||||||
|
|
||||||
Player p = (Player) evt.getOwner();
|
Player p = (Player) evt.getOwner();
|
||||||
Quester quester = plugin.getQuester(p.getName());
|
Quester quester = plugin.getQuester(p.getName());
|
||||||
if(quester.hasObjective("tameMob")){
|
if (quester.hasObjective("tameMob")) {
|
||||||
|
|
||||||
quester.tameMob(evt.getEntityType());
|
quester.tameMob(evt.getEntityType());
|
||||||
|
|
||||||
@ -196,12 +211,12 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onEnchantItem(EnchantItemEvent evt){
|
public void onEnchantItem(EnchantItemEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getEnchanter().getName());
|
Quester quester = plugin.getQuester(evt.getEnchanter().getName());
|
||||||
if(quester.hasObjective("enchantItem")){
|
if (quester.hasObjective("enchantItem")) {
|
||||||
|
|
||||||
for(Enchantment e : evt.getEnchantsToAdd().keySet()){
|
for (Enchantment e : evt.getEnchantsToAdd().keySet()) {
|
||||||
|
|
||||||
quester.enchantItem(e, evt.getItem().getType());
|
quester.enchantItem(e, evt.getItem().getType());
|
||||||
|
|
||||||
@ -212,13 +227,13 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onCraftItem(CraftItemEvent evt){
|
public void onCraftItem(CraftItemEvent evt) {
|
||||||
|
|
||||||
if(evt.getWhoClicked() instanceof Player){
|
if (evt.getWhoClicked() instanceof Player) {
|
||||||
|
|
||||||
Player p = (Player) evt.getWhoClicked();
|
Player p = (Player) evt.getWhoClicked();
|
||||||
Quester quester = plugin.getQuester(p.getName());
|
Quester quester = plugin.getQuester(p.getName());
|
||||||
if(quester.hasObjective("craftItem")){
|
if (quester.hasObjective("craftItem")) {
|
||||||
|
|
||||||
quester.craftItem(evt.getCurrentItem());
|
quester.craftItem(evt.getCurrentItem());
|
||||||
|
|
||||||
@ -229,16 +244,16 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent evt){
|
public void onInventoryClick(InventoryClickEvent evt) {
|
||||||
|
|
||||||
if(evt.getWhoClicked() instanceof Player && evt.getCursor() != null){
|
if (evt.getWhoClicked() instanceof Player && evt.getCursor() != null) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
||||||
if(quester.currentQuest != null){
|
if (quester.currentQuest != null) {
|
||||||
|
|
||||||
if(quester.currentQuest.questItems.containsKey(evt.getCursor().getType())){
|
if (quester.currentQuest.questItems.containsKey(evt.getCursor().getType())) {
|
||||||
|
|
||||||
if(evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() > 52){
|
if (evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() > 52) {
|
||||||
quester.collectItem(evt.getCursor());
|
quester.collectItem(evt.getCursor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,79 +263,19 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(evt.getWhoClicked() instanceof Player && evt.getCurrentItem() != null){
|
if (evt.getWhoClicked() instanceof Player && evt.getCurrentItem() != null) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
Quester quester = plugin.getQuester(evt.getWhoClicked().getName());
|
||||||
if(quester.currentQuest != null){
|
if (quester.currentQuest != null) {
|
||||||
|
|
||||||
if(quester.currentQuest.questItems.containsKey(evt.getCurrentItem().getType())){
|
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){
|
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.");
|
((Player) evt.getWhoClicked()).sendMessage(ChatColor.YELLOW + "You may not modify Quest items in your inventory.");
|
||||||
evt.setCancelled(true);
|
evt.setCancelled(true);
|
||||||
((Player) evt.getWhoClicked()).updateInventory();
|
((Player) evt.getWhoClicked()).updateInventory();
|
||||||
}else if(evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() < 53)
|
} else if (evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() < 53) {
|
||||||
quester.collectItem(evt.getCurrentItem());
|
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){
|
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
|
||||||
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("killMob"))
|
|
||||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}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());
|
|
||||||
if(quester.hasObjective("killMob"))
|
|
||||||
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -332,55 +287,58 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerDeath(PlayerDeathEvent evt){
|
public void onEntityDeath(EntityDeathEvent evt) {
|
||||||
|
|
||||||
if(evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent){
|
if (evt.getEntity() instanceof Player == false) {
|
||||||
|
|
||||||
|
if (evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||||
|
|
||||||
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().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();
|
||||||
boolean okay = true;
|
boolean okay = true;
|
||||||
|
|
||||||
if(plugin.citizens != null){
|
if (plugin.citizens != null) {
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity()))
|
if (plugin.citizens.getNPCRegistry().isNPC(player)) {
|
||||||
okay = false;
|
okay = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(okay){
|
if (okay) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if (quester.hasObjective("killMob")) {
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(damager instanceof Player){
|
} else if (damager instanceof Player) {
|
||||||
|
|
||||||
Player player = (Player) damager;
|
|
||||||
boolean okay = true;
|
boolean okay = true;
|
||||||
|
|
||||||
if(plugin.citizens != null){
|
if (plugin.citizens != null) {
|
||||||
|
if (plugin.citizens.getNPCRegistry().isNPC(damager)) {
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity()))
|
|
||||||
okay = false;
|
okay = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(okay){
|
if (okay) {
|
||||||
|
|
||||||
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if (quester.hasObjective("killMob")) {
|
||||||
quester.killPlayer(evt.getEntity().getName());
|
quester.killMob(evt.getEntity().getLocation(), evt.getEntity().getType());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -389,28 +347,67 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
@EventHandler
|
||||||
public void onPlayerDropItem(PlayerDropItemEvent evt){
|
public void onPlayerDeath(PlayerDeathEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
if (evt.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
|
||||||
if(quester.currentQuest != null){
|
|
||||||
|
|
||||||
if(quester.currentQuest.questItems.containsKey(evt.getItemDrop().getItemStack().getType())){
|
EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) evt.getEntity().getLastDamageCause();
|
||||||
|
Entity damager = damageEvent.getDamager();
|
||||||
|
|
||||||
evt.getPlayer().sendMessage(ChatColor.YELLOW + "You may not discard Quest items.");
|
if (damager != null) {
|
||||||
evt.setCancelled(true);
|
|
||||||
|
if (damager instanceof Projectile) {
|
||||||
|
|
||||||
|
Projectile p = (Projectile) damager;
|
||||||
|
if (p.getShooter() instanceof Player) {
|
||||||
|
|
||||||
|
Player player = (Player) p.getShooter();
|
||||||
|
boolean okay = true;
|
||||||
|
|
||||||
|
if (plugin.citizens != null) {
|
||||||
|
if (plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (okay) {
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if (quester.hasObjective("killPlayer")) {
|
||||||
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (damager instanceof Player) {
|
||||||
|
|
||||||
|
Player player = (Player) damager;
|
||||||
|
boolean okay = true;
|
||||||
|
|
||||||
|
if (plugin.citizens != null) {
|
||||||
|
|
||||||
|
if (plugin.citizens.getNPCRegistry().isNPC(player) || plugin.citizens.getNPCRegistry().isNPC(evt.getEntity())) {
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (okay) {
|
||||||
|
|
||||||
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
|
if (quester.hasObjective("killPlayer")) {
|
||||||
|
quester.killPlayer(evt.getEntity().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -419,25 +416,54 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent evt){
|
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 quester = new Quester(plugin);
|
||||||
quester.name = evt.getPlayer().getName();
|
quester.name = evt.getPlayer().getName();
|
||||||
if(new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()){
|
if (new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()) {
|
||||||
quester.loadData();
|
quester.loadData();
|
||||||
}else {
|
} else {
|
||||||
quester.saveData();
|
quester.saveData();
|
||||||
}
|
}
|
||||||
plugin.questers.put(evt.getPlayer().getName(), quester);
|
plugin.questers.put(evt.getPlayer().getName(), quester);
|
||||||
|
|
||||||
for(String s : quester.completedQuests){
|
for (String s : quester.completedQuests) {
|
||||||
|
|
||||||
for(Quest q : plugin.quests){
|
for (Quest q : plugin.quests) {
|
||||||
|
|
||||||
if(q.name.equalsIgnoreCase(s)){
|
if (q.name.equalsIgnoreCase(s)) {
|
||||||
|
|
||||||
if(quester.completedTimes.containsKey(q.name) == false && q.redoDelay > -1)
|
if (quester.completedTimes.containsKey(q.name) == false && q.redoDelay > -1) {
|
||||||
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +477,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent evt){
|
public void onPlayerQuit(PlayerQuitEvent evt) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
quester.saveData();
|
quester.saveData();
|
||||||
@ -460,19 +486,20 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent evt){
|
public void onPlayerMove(PlayerMoveEvent evt) {
|
||||||
|
|
||||||
boolean isPlayer = true;
|
boolean isPlayer = true;
|
||||||
if(plugin.getServer().getPluginManager().getPlugin("Citizens") != null){
|
if (plugin.getServer().getPluginManager().getPlugin("Citizens") != null) {
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer()))
|
if (plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||||
isPlayer = false;
|
isPlayer = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayer){
|
if (isPlayer) {
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
|
|
||||||
if(quester.hasObjective("reachLocation")){
|
if (quester.hasObjective("reachLocation")) {
|
||||||
|
|
||||||
quester.reachLocation(evt.getTo());
|
quester.reachLocation(evt.getTo());
|
||||||
|
|
||||||
@ -481,5 +508,4 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,8 @@ public class Quester {
|
|||||||
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
||||||
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
||||||
Map<NPC, Boolean> citizensInteracted = new HashMap<NPC, Boolean>();
|
Map<NPC, Boolean> citizensInteracted = new HashMap<NPC, Boolean>();
|
||||||
|
LinkedList<NPC> citizensKilled = new LinkedList<NPC>();
|
||||||
|
LinkedList<Integer> citizenNumKilled = new LinkedList<Integer>();
|
||||||
LinkedList<Location> locationsReached = new LinkedList<Location>();
|
LinkedList<Location> locationsReached = new LinkedList<Location>();
|
||||||
LinkedList<Boolean> hasReached = new LinkedList<Boolean>();
|
LinkedList<Boolean> hasReached = new LinkedList<Boolean>();
|
||||||
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
||||||
@ -358,7 +360,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 {
|
||||||
|
|
||||||
@ -371,6 +373,24 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (NPC n : currentStage.citizensToKill) {
|
||||||
|
|
||||||
|
for (NPC n2 : citizensKilled) {
|
||||||
|
|
||||||
|
if (citizenNumKilled.get(citizensKilled.indexOf(n2)) < currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(n))) {
|
||||||
|
|
||||||
|
unfinishedObjectives.add(ChatColor.GREEN + "Kill " + n.getFullName() + ChatColor.GREEN);
|
||||||
|
|
||||||
|
} else {a
|
||||||
|
|
||||||
|
finishedObjectives.add(ChatColor.GRAY + "Kill " + n.getFullName());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for (Entry e : currentStage.mobsToTame.entrySet()) {
|
for (Entry e : currentStage.mobsToTame.entrySet()) {
|
||||||
|
|
||||||
@ -1056,7 +1076,7 @@ public class Quester {
|
|||||||
} else if (objective.equalsIgnoreCase("killNPC")) {
|
} else if (objective.equalsIgnoreCase("killNPC")) {
|
||||||
|
|
||||||
String message = ChatColor.GREEN + "(Completed) Kill " + npc.getName();
|
String message = ChatColor.GREEN + "(Completed) Kill " + npc.getName();
|
||||||
message = message + " " + currentStage.citizenNumToKill.
|
message = message + " " + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(npc)) + "/" + currentStage.citizenNumToKill.get(currentStage.citizensToKill.indexOf(npc));
|
||||||
p.sendMessage(message);
|
p.sendMessage(message);
|
||||||
if (testComplete()) {
|
if (testComplete()) {
|
||||||
currentQuest.nextStage(this);
|
currentQuest.nextStage(this);
|
||||||
@ -1203,6 +1223,15 @@ public class Quester {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentStage.citizensToKill.isEmpty() == false) {
|
||||||
|
for (NPC n : currentStage.citizensToKill) {
|
||||||
|
|
||||||
|
citizensKilled.add(n);
|
||||||
|
citizenNumKilled.add(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (currentStage.blocksToCut.isEmpty() == false) {
|
if (currentStage.blocksToCut.isEmpty() == false) {
|
||||||
for (Material m : currentStage.blocksToCut.keySet()) {
|
for (Material m : currentStage.blocksToCut.keySet()) {
|
||||||
@ -1264,6 +1293,8 @@ public class Quester {
|
|||||||
radiiToKillWithin.clear();
|
radiiToKillWithin.clear();
|
||||||
playersKilled = 0;
|
playersKilled = 0;
|
||||||
citizensInteracted.clear();
|
citizensInteracted.clear();
|
||||||
|
citizensKilled.clear();
|
||||||
|
citizenNumKilled.clear();
|
||||||
locationsReached.clear();
|
locationsReached.clear();
|
||||||
hasReached.clear();
|
hasReached.clear();
|
||||||
radiiToReachWithin.clear();
|
radiiToReachWithin.clear();
|
||||||
@ -1725,6 +1756,21 @@ public class Quester {
|
|||||||
data.set("has-talked-to", hasTalked);
|
data.set("has-talked-to", hasTalked);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(citizensKilled.isEmpty() == false) {
|
||||||
|
|
||||||
|
LinkedList<Integer> npcIds = new LinkedList<Integer>();
|
||||||
|
|
||||||
|
for (NPC n : citizensKilled) {
|
||||||
|
|
||||||
|
npcIds.add(n.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
data.set("citizen-ids-killed", npcIds);
|
||||||
|
data.set("citizen-amounts-killed", citizenNumKilled);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (locationsReached.isEmpty() == false) {
|
if (locationsReached.isEmpty() == false) {
|
||||||
|
|
||||||
@ -2303,6 +2349,20 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.contains("citizen-ids-killed")) {
|
||||||
|
|
||||||
|
List<Integer> ids = data.getIntegerList("citizen-ids-killed");
|
||||||
|
List<Integer> num = data.getIntegerList("citizen-amounts-killed");
|
||||||
|
|
||||||
|
for (int i : ids) {
|
||||||
|
|
||||||
|
citizensKilled.add(plugin.citizens.getNPCRegistry().getById(i));
|
||||||
|
citizenNumKilled.add(num.get(ids.indexOf(i)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (data.contains("locations-to-reach")) {
|
if (data.contains("locations-to-reach")) {
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
public class Quests extends JavaPlugin implements ConversationAbandonedListener {
|
||||||
|
|
||||||
public static Economy economy = null;
|
public static Economy economy = null;
|
||||||
public static Permission permission = null;
|
public static Permission permission = null;
|
||||||
@ -64,13 +64,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
pListener = new PlayerListener(this);
|
pListener = new PlayerListener(this);
|
||||||
npcListener = new NpcListener(this);
|
npcListener = new NpcListener(this);
|
||||||
|
|
||||||
this.conversationFactory = new ConversationFactory(this)
|
this.conversationFactory = new ConversationFactory(this).withModality(false).withPrefix(new SummoningConversationPrefix()).withFirstPrompt(new QuestPrompt()).withTimeout(20).thatExcludesNonPlayersWithMessage("Console may not perform this conversation!").addConversationAbandonedListener(this);
|
||||||
.withModality(false)
|
|
||||||
.withPrefix(new SummoningConversationPrefix())
|
|
||||||
.withFirstPrompt(new QuestPrompt())
|
|
||||||
.withTimeout(20)
|
|
||||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
|
||||||
.addConversationAbandonedListener(this);
|
|
||||||
|
|
||||||
questFactory = new QuestFactory(this);
|
questFactory = new QuestFactory(this);
|
||||||
|
|
||||||
@ -181,18 +175,18 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<Quest> getQuests(){
|
public LinkedList<Quest> getQuests() {
|
||||||
return quests;
|
return quests;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QuestPrompt extends FixedSetPrompt {
|
private class QuestPrompt extends FixedSetPrompt {
|
||||||
|
|
||||||
public QuestPrompt() {
|
public QuestPrompt() {
|
||||||
super("Yes","No");
|
super("Yes", "No");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -229,10 +223,8 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
return ChatColor.GREEN + "Quests: " + ChatColor.GRAY;
|
return ChatColor.GREEN + "Quests: " + ChatColor.GRAY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
|
|
||||||
FileConfiguration config = getConfig();
|
FileConfiguration config = getConfig();
|
||||||
@ -281,13 +273,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
|
||||||
|
|
||||||
if(cmd.getName().equalsIgnoreCase("editor")){
|
if (cmd.getName().equalsIgnoreCase("editor")) {
|
||||||
|
|
||||||
questFactory.convoCreator.buildConversation((Conversable) cs).begin();
|
questFactory.convoCreator.buildConversation((Conversable) cs).begin();
|
||||||
|
|
||||||
}
|
} else if (cmd.getName().equalsIgnoreCase("quest")) {
|
||||||
|
|
||||||
else if (cmd.getName().equalsIgnoreCase("quest")) {
|
|
||||||
|
|
||||||
if (cs instanceof Player) {
|
if (cs instanceof Player) {
|
||||||
|
|
||||||
@ -631,14 +621,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
quester.questToTake = quest.name;
|
quester.questToTake = quest.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 + getQuest(quester.questToTake).description + "\n";
|
+ ChatColor.RESET + getQuest(quester.questToTake).description + "\n";
|
||||||
|
|
||||||
cs.sendMessage(s);
|
cs.sendMessage(s);
|
||||||
conversationFactory.buildConversation((Conversable)cs).begin();
|
conversationFactory.buildConversation((Conversable) cs).begin();
|
||||||
return true;
|
return true;
|
||||||
}else{
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1340,16 +1330,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
printSevere(ChatColor.GOLD + "[Quests] Quest block \'" + ChatColor.DARK_PURPLE + s + ChatColor.GOLD + "\' is missing " + ChatColor.RED + "name:");
|
printSevere(ChatColor.GOLD + "[Quests] Quest block \'" + ChatColor.DARK_PURPLE + s + ChatColor.GOLD + "\' is missing " + ChatColor.RED + "name:");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".npc-giver-id")) {
|
if (config.contains("quests." + s + ".npc-giver-id")) {
|
||||||
|
|
||||||
if(citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")) != null){
|
if (citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")) != null) {
|
||||||
|
|
||||||
quest.npcStart = citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id"));
|
quest.npcStart = citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id"));
|
||||||
questNPCs.add(citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")));
|
questNPCs.add(citizens.getNPCRegistry().getById(config.getInt("quests." + s + ".npc-giver-id")));
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "npc-giver-id: " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid NPC id!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "npc-giver-id: " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid NPC id!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1358,10 +1348,10 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
if (config.contains("quests." + s + ".block-start")) {
|
if (config.contains("quests." + s + ".block-start")) {
|
||||||
|
|
||||||
Location location = getLocation(config.getString("quests." + s + ".block-start"));
|
Location location = getLocation(config.getString("quests." + s + ".block-start"));
|
||||||
if(location != null)
|
if (location != null) {
|
||||||
quest.blockStart = location;
|
quest.blockStart = location;
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "block-start: " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not in proper location format!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "block-start: " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not in proper location format!");
|
||||||
printSevere(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
|
printSevere(ChatColor.GOLD + "[Quests] Proper location format is: \"WorldName x y z\"");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2021,7 +2011,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Integer> npcIdsToKill;
|
List<Integer> npcIdsToKill;
|
||||||
List<Integer> npcKillAmounts;
|
List<Integer> npcKillAmounts;
|
||||||
|
|
||||||
@ -2029,9 +2019,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".npc-ids-to-kill"), Integer.class)) {
|
if (checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".npc-ids-to-kill"), Integer.class)) {
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts")){
|
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts")) {
|
||||||
|
|
||||||
if(checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts"), Integer.class)) {
|
if (checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts"), Integer.class)) {
|
||||||
|
|
||||||
npcIdsToKill = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".npc-ids-to-kill");
|
npcIdsToKill = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".npc-ids-to-kill");
|
||||||
npcKillAmounts = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts");
|
npcKillAmounts = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".npc-kill-amounts");
|
||||||
@ -2039,11 +2029,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (citizens.getNPCRegistry().getById(i) != null) {
|
if (citizens.getNPCRegistry().getById(i) != null) {
|
||||||
|
|
||||||
if(npcKillAmounts.get(npcIdsToKill.indexOf(i)) > 0){
|
if (npcKillAmounts.get(npcIdsToKill.indexOf(i)) > 0) {
|
||||||
stage.citizensToKill.add(citizens.getNPCRegistry().getById(i));
|
stage.citizensToKill.add(citizens.getNPCRegistry().getById(i));
|
||||||
stage.citizenNumToKill.add(npcKillAmounts.get(npcIdsToKill.indexOf(i)));
|
stage.citizenNumToKill.add(npcKillAmounts.get(npcIdsToKill.indexOf(i)));
|
||||||
questNPCs.add(citizens.getNPCRegistry().getById(i));
|
questNPCs.add(citizens.getNPCRegistry().getById(i));
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + npcKillAmounts.get(npcIdsToKill.indexOf(i)) + ChatColor.GOLD + " inside " + ChatColor.GREEN + "npc-kill-amounts: " + ChatColor.GOLD + "inside " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a positive number!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + npcKillAmounts.get(npcIdsToKill.indexOf(i)) + ChatColor.GOLD + " inside " + ChatColor.GREEN + "npc-kill-amounts: " + ChatColor.GOLD + "inside " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a positive number!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
@ -2062,13 +2052,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "npc-kill-amounts:");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "npc-kill-amounts:");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "npc-ids-to-kill: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "npc-ids-to-kill: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
@ -2539,7 +2529,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".sheep-to-shear"), String.class)) {
|
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".sheep-to-shear"), String.class)) {
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".stages.ordered." + s2 + ".sheep-amounts")){
|
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".sheep-amounts")) {
|
||||||
|
|
||||||
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".sheep-amounts"), Integer.class)) {
|
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".sheep-amounts"), Integer.class)) {
|
||||||
|
|
||||||
@ -2612,7 +2602,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
stage.sheepToShear.put(DyeColor.YELLOW, shearAmounts.get(sheep.indexOf(color)));
|
stage.sheepToShear.put(DyeColor.YELLOW, shearAmounts.get(sheep.indexOf(color)));
|
||||||
|
|
||||||
} else{
|
} else {
|
||||||
|
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + color + ChatColor.GOLD + " inside " + ChatColor.GREEN + "sheep-to-shear: " + ChatColor.GOLD + "inside " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid color!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + color + ChatColor.GOLD + " inside " + ChatColor.GREEN + "sheep-to-shear: " + ChatColor.GOLD + "inside " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid color!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
@ -2622,19 +2612,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "sheep-amounts: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "sheep-amounts: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "sheep-amounts:");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "sheep-amounts:");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "sheep-to-shear: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of colors!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "sheep-to-shear: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of colors!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
@ -2644,11 +2634,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids")) {
|
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids"), Integer.class)){
|
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids"), Integer.class)) {
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts")){
|
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts"), Integer.class)){
|
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts"), Integer.class)) {
|
||||||
|
|
||||||
List<Integer> craftIds = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids");
|
List<Integer> craftIds = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".craft-item-ids");
|
||||||
List<Integer> craftAmounts = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts");
|
List<Integer> craftAmounts = config.getIntegerList("quests." + s + ".stages.ordered." + s2 + ".craft-item-amounts");
|
||||||
@ -2659,19 +2649,19 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "craft-item-amounts: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "craft-item-amounts: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "craft-item-amounts:");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "craft-item-amounts:");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "craft-item-ids: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "craft-item-ids: " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
@ -2683,9 +2673,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
Event evt = Event.getEvent(config.getString("quests." + s + ".stages.ordered." + s2 + ".event"), this, quest);
|
Event evt = Event.getEvent(config.getString("quests." + s + ".stages.ordered." + s2 + ".event"), this, quest);
|
||||||
|
|
||||||
if( evt != null)
|
if (evt != null) {
|
||||||
stage.event = evt;
|
stage.event = evt;
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "Event " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " failed to load.");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "Event " + ChatColor.GOLD + "in " + ChatColor.LIGHT_PURPLE + "Stage " + s2 + ChatColor.GOLD + " of Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " failed to load.");
|
||||||
stageFailed = true;
|
stageFailed = true;
|
||||||
break;
|
break;
|
||||||
@ -2695,32 +2685,32 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
stage.citizensToInteract = npcsToTalkTo;
|
stage.citizensToInteract = npcsToTalkTo;
|
||||||
|
|
||||||
if(stageFailed){
|
if (stageFailed) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
quest.stages.add(stage);
|
quest.stages.add(stage);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(stageFailed){
|
if (stageFailed) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load rewards
|
//Load rewards
|
||||||
if (config.contains("quests." + s + ".rewards.item-ids")) {
|
if (config.contains("quests." + s + ".rewards.item-ids")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.item-ids"), Integer.class)){
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.item-ids"), Integer.class)) {
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".rewards.item-amounts")){
|
if (config.contains("quests." + s + ".rewards.item-amounts")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.item-amounts"), Integer.class)) {
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.item-amounts"), Integer.class)) {
|
||||||
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
for (int i : config.getIntegerList("quests." + s + ".rewards.item-ids")) {
|
for (int i : config.getIntegerList("quests." + s + ".rewards.item-ids")) {
|
||||||
|
|
||||||
Material m = Material.getMaterial(i);
|
Material m = Material.getMaterial(i);
|
||||||
if(m == null){
|
if (m == null) {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + i + ChatColor.GOLD + " in " + ChatColor.GREEN + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + i + ChatColor.GOLD + " in " + ChatColor.GREEN + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
failed = true;
|
failed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2729,20 +2719,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(failed)
|
if (failed) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-amounts: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of numbers!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.AQUA + "Rewards " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "item-amounts:");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.AQUA + "Rewards " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "item-amounts:");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-ids: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "item-ids: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of item ids!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2773,9 +2764,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.commands")) {
|
if (config.contains("quests." + s + ".rewards.commands")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.commands"), String.class))
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.commands"), String.class)) {
|
||||||
quest.commands = config.getStringList("quests." + s + ".rewards.commands");
|
quest.commands = config.getStringList("quests." + s + ".rewards.commands");
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "commands: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of commands!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "commands: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of commands!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2784,9 +2775,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.permissions")) {
|
if (config.contains("quests." + s + ".rewards.permissions")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.permissions"), String.class))
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.permissions"), String.class)) {
|
||||||
quest.permissions = config.getStringList("quests." + s + ".rewards.permissions");
|
quest.permissions = config.getStringList("quests." + s + ".rewards.permissions");
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "permissions: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of permissions!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "permissions: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of permissions!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2817,9 +2808,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.heroes-class")) {
|
if (config.contains("quests." + s + ".rewards.heroes-class")) {
|
||||||
|
|
||||||
if(heroes.getClassManager().getClass("quests." + s + ".rewards.heroes-class") != null)
|
if (heroes.getClassManager().getClass("quests." + s + ".rewards.heroes-class") != null) {
|
||||||
quest.heroesClass = config.getString("quests." + s + ".rewards.heroes-class");
|
quest.heroesClass = config.getString("quests." + s + ".rewards.heroes-class");
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "heroes-class: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid Heroes class name!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "heroes-class: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid Heroes class name!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2828,9 +2819,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.heroes-secondary-class")) {
|
if (config.contains("quests." + s + ".rewards.heroes-secondary-class")) {
|
||||||
|
|
||||||
if(heroes.getClassManager().getClass("quests." + s + ".rewards.heroes-secondary-class") != null)
|
if (heroes.getClassManager().getClass("quests." + s + ".rewards.heroes-secondary-class") != null) {
|
||||||
quest.heroesSecClass = config.getString("quests." + s + ".rewards.heroes-secondary-class");
|
quest.heroesSecClass = config.getString("quests." + s + ".rewards.heroes-secondary-class");
|
||||||
else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "heroes-secondary-class: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid Heroes secondary class name!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "heroes-secondary-class: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid Heroes secondary class name!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2839,32 +2830,33 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
if (config.contains("quests." + s + ".rewards.mcmmo-skills")) {
|
if (config.contains("quests." + s + ".rewards.mcmmo-skills")) {
|
||||||
|
|
||||||
if(Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-skills"), String.class)){
|
if (Quests.checkList(config.getList("quests." + s + ".rewards.mcmmo-skills"), String.class)) {
|
||||||
|
|
||||||
if(config.contains("quests." + s + ".rewards.mcmmo-levels")){
|
if (config.contains("quests." + s + ".rewards.mcmmo-levels")) {
|
||||||
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
for(String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")){
|
for (String skill : config.getStringList("quests." + s + ".rewards.mcmmo-skills")) {
|
||||||
|
|
||||||
if(Quests.getMcMMOSkill(skill) == null){
|
if (Quests.getMcMMOSkill(skill) == null) {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + skill + ChatColor.GOLD + " in " + ChatColor.GREEN + "mcmmo-skills: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid mcMMO skill name!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + skill + ChatColor.GOLD + " in " + ChatColor.GREEN + "mcmmo-skills: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a valid mcMMO skill name!");
|
||||||
failed = true;
|
failed = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(failed)
|
if (failed) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
quest.mcmmoSkills = config.getStringList("quests." + s + ".rewards.mcmmo-skills");
|
quest.mcmmoSkills = config.getStringList("quests." + s + ".rewards.mcmmo-skills");
|
||||||
quest.mcmmoAmounts = config.getIntegerList("quests." + s + ".rewards.mcmmo-levels");
|
quest.mcmmoAmounts = config.getIntegerList("quests." + s + ".rewards.mcmmo-levels");
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.AQUA + "Rewards " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "mcmmo-levels:");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.AQUA + "Rewards " + ChatColor.GOLD + "for Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is missing " + ChatColor.RED + "mcmmo-levels:");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
} else {
|
||||||
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "mcmmo-skills: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of mcMMO skill names!");
|
printSevere(ChatColor.GOLD + "[Quests] " + ChatColor.RED + "mcmmo-skills: " + ChatColor.AQUA + "Reward " + ChatColor.GOLD + "in Quest " + ChatColor.DARK_PURPLE + quest.name + ChatColor.GOLD + " is not a list of mcMMO skill names!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2976,21 +2968,21 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
return sortedMap;
|
return sortedMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printSevere(String s){
|
public static void printSevere(String s) {
|
||||||
|
|
||||||
s = ChatColor.stripColor(s);
|
s = ChatColor.stripColor(s);
|
||||||
log.severe(s);
|
log.severe(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printWarning(String s){
|
public static void printWarning(String s) {
|
||||||
|
|
||||||
s = ChatColor.stripColor(s);
|
s = ChatColor.stripColor(s);
|
||||||
log.warning(s);
|
log.warning(s);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void printInfo(String s){
|
public static void printInfo(String s) {
|
||||||
|
|
||||||
s = ChatColor.stripColor(s);
|
s = ChatColor.stripColor(s);
|
||||||
log.info(s);
|
log.info(s);
|
||||||
@ -3218,23 +3210,25 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
public static Location getLocation(String arg) {
|
public static Location getLocation(String arg) {
|
||||||
|
|
||||||
String[] info = arg.split(" ");
|
String[] info = arg.split(" ");
|
||||||
if(info.length != 4)
|
if (info.length != 4) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
double x;
|
double x;
|
||||||
double y;
|
double y;
|
||||||
double z;
|
double z;
|
||||||
|
|
||||||
try{
|
try {
|
||||||
x = Double.parseDouble(info[1]);
|
x = Double.parseDouble(info[1]);
|
||||||
y = Double.parseDouble(info[2]);
|
y = Double.parseDouble(info[2]);
|
||||||
z = Double.parseDouble(info[3]);
|
z = Double.parseDouble(info[3]);
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Bukkit.getServer().getWorld(info[0]) == null)
|
if (Bukkit.getServer().getWorld(info[0]) == null) {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
Location finalLocation = new Location(Bukkit.getServer().getWorld(info[0]), x, y, z);
|
Location finalLocation = new Location(Bukkit.getServer().getWorld(info[0]), x, y, z);
|
||||||
|
|
||||||
@ -3264,9 +3258,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
return Effect.ZOMBIE_CHEW_IRON_DOOR;
|
return Effect.ZOMBIE_CHEW_IRON_DOOR;
|
||||||
} else if (eff.equalsIgnoreCase("ZOMBIE_CHEW_WOODEN_DOOR")) {
|
} else if (eff.equalsIgnoreCase("ZOMBIE_CHEW_WOODEN_DOOR")) {
|
||||||
return Effect.ZOMBIE_CHEW_WOODEN_DOOR;
|
return Effect.ZOMBIE_CHEW_WOODEN_DOOR;
|
||||||
} else if (eff.equalsIgnoreCase("ZOMBIE_DESTROY_DOOR")){
|
} else if (eff.equalsIgnoreCase("ZOMBIE_DESTROY_DOOR")) {
|
||||||
return Effect.ZOMBIE_DESTROY_DOOR;
|
return Effect.ZOMBIE_DESTROY_DOOR;
|
||||||
} else{
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3550,18 +3544,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCurrency(boolean plural){
|
public static String getCurrency(boolean plural) {
|
||||||
|
|
||||||
if(plural){
|
if (plural) {
|
||||||
if(Quests.economy.currencyNamePlural().trim().isEmpty())
|
if (Quests.economy.currencyNamePlural().trim().isEmpty()) {
|
||||||
return "Money";
|
return "Money";
|
||||||
else
|
} else {
|
||||||
return Quests.economy.currencyNamePlural();
|
return Quests.economy.currencyNamePlural();
|
||||||
}else{
|
}
|
||||||
if(Quests.economy.currencyNameSingular().trim().isEmpty())
|
} else {
|
||||||
|
if (Quests.economy.currencyNameSingular().trim().isEmpty()) {
|
||||||
return "Money";
|
return "Money";
|
||||||
else
|
} else {
|
||||||
return Quests.economy.currencyNameSingular();
|
return Quests.economy.currencyNameSingular();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3623,11 +3619,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Quest getQuest(String s){
|
public Quest getQuest(String s) {
|
||||||
|
|
||||||
for(Quest q : quests){
|
for (Quest q : quests) {
|
||||||
if(q.name.equalsIgnoreCase(s))
|
if (q.name.equalsIgnoreCase(s)) {
|
||||||
return q;
|
return q;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -15,168 +15,227 @@ import org.bukkit.entity.EntityType;
|
|||||||
public class Stage {
|
public class Stage {
|
||||||
|
|
||||||
public String finished;
|
public String finished;
|
||||||
|
|
||||||
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToDamage = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToBreak = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToPlace = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
Map<Map<Material, Integer>, Boolean> itemsToCollect = new HashMap<Map<Material, Integer>, Boolean>();
|
Map<Map<Material, Integer>, Boolean> itemsToCollect = new HashMap<Map<Material, Integer>, Boolean>();
|
||||||
|
|
||||||
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToUse = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> blocksToCut = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
Integer fishToCatch;
|
Integer fishToCatch;
|
||||||
Integer playersToKill;
|
Integer playersToKill;
|
||||||
|
|
||||||
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
Map<Map<Enchantment, Material>, Integer> itemsToEnchant = new HashMap<Map<Enchantment, Material>, Integer>();
|
||||||
|
|
||||||
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
LinkedList<EntityType> mobsToKill = new LinkedList<EntityType>();
|
||||||
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
LinkedList<Integer> mobNumToKill = new LinkedList<Integer>();
|
||||||
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
LinkedList<Location> locationsToKillWithin = new LinkedList<Location>();
|
||||||
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
LinkedList<Integer> radiiToKillWithin = new LinkedList<Integer>();
|
||||||
LinkedList<String> areaNames = new LinkedList<String>();
|
LinkedList<String> areaNames = new LinkedList<String>();
|
||||||
|
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>(){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
LinkedList<NPC> citizensToInteract = new LinkedList<NPC>();
|
if (o instanceof LinkedList) {
|
||||||
|
|
||||||
LinkedList<NPC> citizensToKill = new LinkedList<NPC>();
|
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||||
|
|
||||||
|
for (NPC n : this) {
|
||||||
|
|
||||||
|
NPC other = otherList.get(this.indexOf(n));
|
||||||
|
if (other.getId() != n.getId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
LinkedList<NPC> citizensToKill = new LinkedList<NPC>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
|
if (o instanceof LinkedList) {
|
||||||
|
|
||||||
|
LinkedList<NPC> otherList = (LinkedList<NPC>) o;
|
||||||
|
|
||||||
|
for (NPC n : this) {
|
||||||
|
|
||||||
|
NPC other = otherList.get(this.indexOf(n));
|
||||||
|
if (other.getId() != n.getId()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
|
LinkedList<Integer> citizenNumToKill = new LinkedList<Integer>();
|
||||||
|
|
||||||
LinkedList<Location> locationsToReach = new LinkedList<Location>();
|
LinkedList<Location> locationsToReach = new LinkedList<Location>();
|
||||||
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
LinkedList<Integer> radiiToReachWithin = new LinkedList<Integer>();
|
||||||
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
|
LinkedList<World> worldsToReachWithin = new LinkedList<World>();
|
||||||
LinkedList<String> locationNames = new LinkedList<String>();
|
LinkedList<String> locationNames = new LinkedList<String>();
|
||||||
|
|
||||||
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
Map<EntityType, Integer> mobsToTame = new EnumMap<EntityType, Integer>(EntityType.class);
|
||||||
|
|
||||||
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
Map<DyeColor, Integer> sheepToShear = new EnumMap<DyeColor, Integer>(DyeColor.class);
|
||||||
|
|
||||||
Map<Material, Integer> itemsToCraft = new EnumMap<Material, Integer>(Material.class);
|
Map<Material, Integer> itemsToCraft = new EnumMap<Material, Integer>(Material.class);
|
||||||
|
|
||||||
String script;
|
String script;
|
||||||
|
|
||||||
Event event;
|
Event event;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o){
|
public boolean equals(Object o) {
|
||||||
|
|
||||||
if(o instanceof Stage){
|
if (o instanceof Stage) {
|
||||||
|
|
||||||
Stage other = (Stage) o;
|
Stage other = (Stage) o;
|
||||||
|
|
||||||
if(other.finished != null && finished != null){
|
if (other.finished != null && finished != null) {
|
||||||
if(other.finished.equals(finished) == false)
|
if (other.finished.equals(finished) == false) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.finished != null && finished == null){
|
}
|
||||||
|
} else if (other.finished != null && finished == null) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.finished == null && finished != null)
|
} else if (other.finished == null && finished != null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.blocksToDamage.equals(blocksToDamage) == false)
|
if (other.blocksToDamage.equals(blocksToDamage) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.blocksToBreak.equals(blocksToBreak) == false)
|
if (other.blocksToBreak.equals(blocksToBreak) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.blocksToPlace.equals(blocksToPlace) == false)
|
if (other.blocksToPlace.equals(blocksToPlace) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.itemsToCollect.equals(itemsToCollect) == false)
|
if (other.itemsToCollect.equals(itemsToCollect) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.blocksToUse.equals(blocksToUse) == false)
|
if (other.blocksToUse.equals(blocksToUse) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.blocksToCut.equals(blocksToCut) == false)
|
if (other.blocksToCut.equals(blocksToCut) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.fishToCatch != null && fishToCatch != null){
|
if (other.fishToCatch != null && fishToCatch != null) {
|
||||||
if(other.fishToCatch.equals(fishToCatch) == false)
|
if (other.fishToCatch.equals(fishToCatch) == false) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.fishToCatch != null && fishToCatch == null){
|
}
|
||||||
|
} else if (other.fishToCatch != null && fishToCatch == null) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.fishToCatch == null && fishToCatch != null)
|
} else if (other.fishToCatch == null && fishToCatch != null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.playersToKill != null && playersToKill != null){
|
if (other.playersToKill != null && playersToKill != null) {
|
||||||
if(other.playersToKill.equals(playersToKill) == false)
|
if (other.playersToKill.equals(playersToKill) == false) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.playersToKill != null && playersToKill == null){
|
}
|
||||||
|
} else if (other.playersToKill != null && playersToKill == null) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.playersToKill == null && playersToKill != null)
|
} else if (other.playersToKill == null && playersToKill != null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.itemsToEnchant.equals(itemsToEnchant) == false)
|
if (other.itemsToEnchant.equals(itemsToEnchant) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.mobsToKill.equals(mobsToKill) == false)
|
if (other.mobsToKill.equals(mobsToKill) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.mobNumToKill.equals(mobNumToKill) == false)
|
if (other.mobNumToKill.equals(mobNumToKill) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.locationsToKillWithin.equals(locationsToKillWithin) == false)
|
if (other.locationsToKillWithin.equals(locationsToKillWithin) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.radiiToKillWithin.equals(radiiToKillWithin) == false)
|
if (other.radiiToKillWithin.equals(radiiToKillWithin) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.areaNames.equals(areaNames) == false)
|
if (other.areaNames.equals(areaNames) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.citizensToInteract.equals(citizensToInteract) == false)
|
if (other.citizensToInteract.equals(citizensToInteract) == false) {
|
||||||
return false;
|
|
||||||
|
|
||||||
if(other.citizensToKill.equals(citizensToKill) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if(other.citizenNumToKill.equals(citizenNumToKill) == false)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.locationsToReach.equals(locationsToReach) == false)
|
if (other.citizensToKill.equals(citizensToKill) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.radiiToReachWithin.equals(radiiToReachWithin) == false)
|
if (other.citizenNumToKill.equals(citizenNumToKill) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.worldsToReachWithin.equals(worldsToReachWithin) == false)
|
if (other.locationsToReach.equals(locationsToReach) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.locationNames.equals(locationNames) == false)
|
if (other.radiiToReachWithin.equals(radiiToReachWithin) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.mobsToTame.equals(mobsToTame) == false)
|
if (other.worldsToReachWithin.equals(worldsToReachWithin) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.sheepToShear.equals(sheepToShear) == false)
|
if (other.locationNames.equals(locationNames) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.itemsToCraft.equals(itemsToCraft) == false)
|
if (other.mobsToTame.equals(mobsToTame) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.script != null && script != null){
|
if (other.sheepToShear.equals(sheepToShear) == false) {
|
||||||
if(other.script.equals(script) == 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;
|
return false;
|
||||||
}else if(other.script != null && script == null){
|
}
|
||||||
|
} else if (other.script != null && script == null) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.script == null && script != null)
|
} else if (other.script == null && script != null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(other.event != null && event != null){
|
if (other.event != null && event != null) {
|
||||||
if(other.event.equals(event) == false)
|
if (other.event.equals(event) == false) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.event != null && event == null){
|
}
|
||||||
|
} else if (other.event != null && event == null) {
|
||||||
return false;
|
return false;
|
||||||
}else if(other.event == null && event != null)
|
} else if (other.event == null && event != null) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user