mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-02 22:48:05 +01:00
Version 1.5.1
This commit is contained in:
parent
f0119d7c8d
commit
2fa387fd5b
12
src/UPDATES
12
src/UPDATES
@ -1,12 +0,0 @@
|
|||||||
- 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?
|
|
||||||
|
|
||||||
- Added catches/printout messages for all quest-reading errors
|
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
|||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Scanner;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -22,7 +21,7 @@ import org.bukkit.potion.PotionEffect;
|
|||||||
public class Event {
|
public class Event {
|
||||||
|
|
||||||
String name = "";
|
String name = "";
|
||||||
|
|
||||||
String message = null;
|
String message = null;
|
||||||
boolean clearInv = false;
|
boolean clearInv = false;
|
||||||
LinkedList<Location> explosions = new LinkedList<Location>();
|
LinkedList<Location> explosions = new LinkedList<Location>();
|
||||||
@ -47,7 +46,7 @@ public class Event {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o){
|
public boolean equals(Object o){
|
||||||
|
|
||||||
if(o instanceof Event){
|
if(o instanceof Event){
|
||||||
|
|
||||||
Event other = (Event) o;
|
Event other = (Event) o;
|
||||||
|
@ -41,7 +41,13 @@ public class NpcListener implements Listener{
|
|||||||
|
|
||||||
if(quester.currentQuest == null){
|
if(quester.currentQuest == null){
|
||||||
|
|
||||||
quester.questToTake = q;
|
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();
|
plugin.conversationFactory.buildConversation((Conversable)player).begin();
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
@ -60,7 +60,14 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
quester.questToTake = q;
|
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();
|
plugin.conversationFactory.buildConversation((Conversable)player).begin();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -265,6 +272,7 @@ public class PlayerListener implements Listener {
|
|||||||
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();
|
||||||
}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());
|
||||||
|
|
||||||
@ -294,7 +302,14 @@ public class PlayerListener implements Listener {
|
|||||||
if(p.getShooter() instanceof Player){
|
if(p.getShooter() instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(player) == false){
|
boolean okay = true;
|
||||||
|
|
||||||
|
if(plugin.citizens != null){
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(player))
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(okay){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killMob"))
|
if(quester.hasObjective("killMob"))
|
||||||
@ -305,7 +320,14 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
}else if(damager instanceof Player){
|
}else if(damager instanceof Player){
|
||||||
|
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(damager) == false){
|
boolean okay = true;
|
||||||
|
|
||||||
|
if(plugin.citizens != null){
|
||||||
|
if(plugin.citizens.getNPCRegistry().isNPC(damager))
|
||||||
|
okay = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(okay){
|
||||||
|
|
||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
@ -339,7 +361,14 @@ public class PlayerListener implements Listener {
|
|||||||
if(p.getShooter() instanceof Player){
|
if(p.getShooter() instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) p.getShooter();
|
Player player = (Player) p.getShooter();
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(player) == false && plugin.citizens.getNPCRegistry().isNPC(evt.getEntity()) == false){
|
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());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if(quester.hasObjective("killPlayer"))
|
||||||
@ -352,7 +381,16 @@ public class PlayerListener implements Listener {
|
|||||||
}else if(damager instanceof Player){
|
}else if(damager instanceof Player){
|
||||||
|
|
||||||
Player player = (Player) damager;
|
Player player = (Player) damager;
|
||||||
if(plugin.citizens.getNPCRegistry().isNPC(player) == false && plugin.citizens.getNPCRegistry().isNPC(evt.getEntity()) == false){
|
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());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if(quester.hasObjective("killPlayer"))
|
if(quester.hasObjective("killPlayer"))
|
||||||
|
@ -21,7 +21,7 @@ public class Quester {
|
|||||||
|
|
||||||
String name;
|
String name;
|
||||||
Quest currentQuest;
|
Quest currentQuest;
|
||||||
Quest questToTake;
|
String questToTake;
|
||||||
Stage currentStage;
|
Stage currentStage;
|
||||||
int questPoints = 0;
|
int questPoints = 0;
|
||||||
Quests plugin;
|
Quests plugin;
|
||||||
@ -522,7 +522,7 @@ public class Quester {
|
|||||||
|
|
||||||
} else if (s.equalsIgnoreCase("catchFish")) {
|
} else if (s.equalsIgnoreCase("catchFish")) {
|
||||||
|
|
||||||
if (currentStage.fishToCatch != null) {
|
if (currentStage.fishToCatch == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -546,7 +546,7 @@ public class Quester {
|
|||||||
|
|
||||||
} else if (s.equalsIgnoreCase("killPlayer")) {
|
} else if (s.equalsIgnoreCase("killPlayer")) {
|
||||||
|
|
||||||
if (currentStage.playersToKill != null) {
|
if (currentStage.playersToKill == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@ -825,8 +825,7 @@ public class Quester {
|
|||||||
|
|
||||||
if ((currentTime - killTime) < comparator) {
|
if ((currentTime - killTime) < comparator) {
|
||||||
|
|
||||||
long minutes = (comparator - (currentTime - killTime)) / 60000;
|
plugin.getServer().getPlayer(name).sendMessage(ChatColor.RED + "[Quests] Kill did not count. You must wait " + ChatColor.DARK_PURPLE + Quests.getTime(comparator - (currentTime - killTime)) + ChatColor.RED + " before you can kill " + ChatColor.DARK_PURPLE + player + ChatColor.RED + " again.");
|
||||||
plugin.getServer().getPlayer(name).sendMessage(ChatColor.RED + "[Quests] Kill did not count. You must wait " + ChatColor.DARK_PURPLE + minutes + " minutes " + ChatColor.RED + " before you can kill " + ChatColor.DARK_PURPLE + player + " again.");
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,20 +61,18 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
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(true)
|
.withModality(false)
|
||||||
.withPrefix(new SummoningConversationPrefix())
|
.withPrefix(new SummoningConversationPrefix())
|
||||||
.withFirstPrompt(new QuestPrompt())
|
.withFirstPrompt(new QuestPrompt())
|
||||||
.withEscapeSequence("/cancel")
|
.withTimeout(20)
|
||||||
.withTimeout(10)
|
|
||||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
||||||
.addConversationAbandonedListener(this);
|
.addConversationAbandonedListener(this);
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (getServer().getPluginManager().getPlugin("Citizens") != null) {
|
if (getServer().getPluginManager().getPlugin("Citizens") != null) {
|
||||||
citizens = (CitizensPlugin) getServer().getPluginManager().getPlugin("Citizens");
|
citizens = (CitizensPlugin) getServer().getPluginManager().getPlugin("Citizens");
|
||||||
@ -181,15 +179,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
printInfo("[Quests] Disabled.");
|
printInfo("[Quests] Disabled.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
public void conversationAbandoned(ConversationAbandonedEvent abandonedEvent) {
|
||||||
if (abandonedEvent.gracefulExit()) {
|
|
||||||
abandonedEvent.getContext().getForWhom().sendRawMessage("Conversation exited gracefully.");
|
|
||||||
} else {
|
|
||||||
abandonedEvent.getContext().getForWhom().sendRawMessage("Conversation abandoned by" + abandonedEvent.getCanceller().getClass().getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class QuestPrompt extends FixedSetPrompt {
|
private class QuestPrompt extends FixedSetPrompt {
|
||||||
@ -199,28 +193,27 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPromptText(ConversationContext context) {
|
public String getPromptText(ConversationContext context) {
|
||||||
return "Accept Quest? " + formatFixedSet();
|
|
||||||
|
return ChatColor.YELLOW + "Accept Quest? " + ChatColor.GREEN + "Yes / No";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Prompt acceptValidatedInput(ConversationContext context, String s) {
|
protected Prompt acceptValidatedInput(ConversationContext context, String s) {
|
||||||
|
|
||||||
Player player = (Player) context.getForWhom();
|
Player player = (Player) context.getForWhom();
|
||||||
if (s.equalsIgnoreCase("Yes") == false) {
|
|
||||||
|
if (s.equalsIgnoreCase("No")) {
|
||||||
|
|
||||||
player.sendMessage(ChatColor.YELLOW + "Cancelled.");
|
player.sendMessage(ChatColor.YELLOW + "Cancelled.");
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
context.setSessionData("who", player.getName());
|
getQuester(player.getName()).takeQuest(getQuest(getQuester(player.getName()).questToTake));
|
||||||
context.setSessionData("message", s);
|
|
||||||
|
|
||||||
player.sendMessage(new SummoningConversationPrefix().getPrefix(context));
|
|
||||||
|
|
||||||
getQuester(player.getName()).takeQuest(getQuester(player.getName()).questToTake);
|
|
||||||
|
|
||||||
return Prompt.END_OF_CONVERSATION;
|
return Prompt.END_OF_CONVERSATION;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,10 +221,11 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrefix(ConversationContext context) {
|
public String getPrefix(ConversationContext context) {
|
||||||
String who = (String)context.getSessionData("who");
|
|
||||||
return ChatColor.GREEN + who + ": " + ChatColor.GRAY + (String) context.getSessionData("message");
|
return ChatColor.GREEN + "Quests: " + ChatColor.GRAY;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -283,16 +277,7 @@ 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("convo")){
|
if (cmd.getName().equalsIgnoreCase("quest")) {
|
||||||
|
|
||||||
if (cs instanceof Conversable) {
|
|
||||||
conversationFactory.buildConversation((Conversable)cs).begin();
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (cmd.getName().equalsIgnoreCase("quest")) {
|
|
||||||
|
|
||||||
if (cs instanceof Player) {
|
if (cs instanceof Player) {
|
||||||
|
|
||||||
@ -608,7 +593,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
|
|
||||||
final Quest quest = questToFind;
|
final Quest quest = questToFind;
|
||||||
final Quester quester = getQuester(cs.getName());
|
final Quester quester = getQuester(cs.getName());
|
||||||
final CommandSender sender = cs;
|
|
||||||
|
|
||||||
if (quester.currentQuest != null) {
|
if (quester.currentQuest != null) {
|
||||||
cs.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
cs.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||||
@ -631,9 +615,17 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (takeable == true) {
|
if (takeable == true) {
|
||||||
|
|
||||||
if (cs instanceof Conversable) {
|
if (cs instanceof Conversable) {
|
||||||
quester.questToTake = quest;
|
|
||||||
|
quester.questToTake = quest.name;
|
||||||
|
|
||||||
|
String s =
|
||||||
|
ChatColor.GOLD + "- " + ChatColor.DARK_PURPLE + quester.questToTake + ChatColor.GOLD + " -\n"
|
||||||
|
+ "\n"
|
||||||
|
+ ChatColor.RESET + getQuest(quester.questToTake).description + "\n";
|
||||||
|
|
||||||
|
cs.sendMessage(s);
|
||||||
conversationFactory.buildConversation((Conversable)cs).begin();
|
conversationFactory.buildConversation((Conversable)cs).begin();
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
@ -2215,7 +2207,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains("quests." + s + ".stages.ordered" + s2 + ".kill-location-radii")) {
|
if (config.contains("quests." + s + ".stages.ordered." + s2 + ".kill-location-radii")) {
|
||||||
|
|
||||||
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".kill-location-radii"), Integer.class)) {
|
if (Quests.checkList(config.getList("quests." + s + ".stages.ordered." + s2 + ".kill-location-radii"), Integer.class)) {
|
||||||
|
|
||||||
@ -2918,26 +2910,26 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasItem(Player player, int i, int i2) {
|
public boolean hasItem(Player player, int i, int i2) {
|
||||||
|
|
||||||
Inventory inv = player.getInventory();
|
Inventory inv = player.getInventory();
|
||||||
@ -3547,4 +3539,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Quest getQuest(String s){
|
||||||
|
|
||||||
|
for(Quest q : quests){
|
||||||
|
if(q.name.equalsIgnoreCase(s))
|
||||||
|
return q;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: Quests
|
name: Quests
|
||||||
main: me.blackvein.quests.Quests
|
main: me.blackvein.quests.Quests
|
||||||
version: 1.4
|
version: 1.5.0
|
||||||
description: Player questing system
|
description: Player questing system
|
||||||
website: http://dev.bukkit.org/server-mods/quests/
|
website: http://dev.bukkit.org/server-mods/quests/
|
||||||
dev-url: http://dev.bukkit.org/server-mods/quests/
|
dev-url: http://dev.bukkit.org/server-mods/quests/
|
||||||
@ -65,7 +65,4 @@ commands:
|
|||||||
aliases: [questsadmin]
|
aliases: [questsadmin]
|
||||||
quest:
|
quest:
|
||||||
description: Quest command
|
description: Quest command
|
||||||
permission: quests.quest
|
|
||||||
convo:
|
|
||||||
description: Convo command
|
|
||||||
permission: quests.quest
|
permission: quests.quest
|
Loading…
Reference in New Issue
Block a user