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.List;
|
||||
import java.util.Map;
|
||||
import java.util.Scanner;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
|
@ -41,7 +41,13 @@ public class NpcListener implements Listener{
|
||||
|
||||
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();
|
||||
|
||||
}else {
|
||||
|
@ -60,7 +60,14 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}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();
|
||||
|
||||
}
|
||||
@ -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){
|
||||
((Player) evt.getWhoClicked()).sendMessage(ChatColor.YELLOW + "You may not modify Quest items in your inventory.");
|
||||
evt.setCancelled(true);
|
||||
((Player) evt.getWhoClicked()).updateInventory();
|
||||
}else if(evt.getInventory().getType().equals(InventoryType.CHEST) == true && evt.getRawSlot() < 53)
|
||||
quester.collectItem(evt.getCurrentItem());
|
||||
|
||||
@ -294,7 +302,14 @@ public class PlayerListener implements Listener {
|
||||
if(p.getShooter() instanceof Player){
|
||||
|
||||
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());
|
||||
if(quester.hasObjective("killMob"))
|
||||
@ -305,7 +320,14 @@ public class PlayerListener implements Listener {
|
||||
|
||||
}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;
|
||||
Quester quester = plugin.getQuester(player.getName());
|
||||
@ -339,7 +361,14 @@ public class PlayerListener implements Listener {
|
||||
if(p.getShooter() instanceof Player){
|
||||
|
||||
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());
|
||||
if(quester.hasObjective("killPlayer"))
|
||||
@ -352,7 +381,16 @@ public class PlayerListener implements Listener {
|
||||
}else if(damager instanceof Player){
|
||||
|
||||
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());
|
||||
if(quester.hasObjective("killPlayer"))
|
||||
|
@ -21,7 +21,7 @@ public class Quester {
|
||||
|
||||
String name;
|
||||
Quest currentQuest;
|
||||
Quest questToTake;
|
||||
String questToTake;
|
||||
Stage currentStage;
|
||||
int questPoints = 0;
|
||||
Quests plugin;
|
||||
@ -522,7 +522,7 @@ public class Quester {
|
||||
|
||||
} else if (s.equalsIgnoreCase("catchFish")) {
|
||||
|
||||
if (currentStage.fishToCatch != null) {
|
||||
if (currentStage.fishToCatch == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -546,7 +546,7 @@ public class Quester {
|
||||
|
||||
} else if (s.equalsIgnoreCase("killPlayer")) {
|
||||
|
||||
if (currentStage.playersToKill != null) {
|
||||
if (currentStage.playersToKill == null) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
@ -825,8 +825,7 @@ public class Quester {
|
||||
|
||||
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 + minutes + " minutes " + ChatColor.RED + " before you can kill " + ChatColor.DARK_PURPLE + player + " again.");
|
||||
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.");
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -66,15 +66,13 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
npcListener = new NpcListener(this);
|
||||
|
||||
this.conversationFactory = new ConversationFactory(this)
|
||||
.withModality(true)
|
||||
.withModality(false)
|
||||
.withPrefix(new SummoningConversationPrefix())
|
||||
.withFirstPrompt(new QuestPrompt())
|
||||
.withEscapeSequence("/cancel")
|
||||
.withTimeout(10)
|
||||
.withTimeout(20)
|
||||
.thatExcludesNonPlayersWithMessage("Console may not perform this conversation!")
|
||||
.addConversationAbandonedListener(this);
|
||||
|
||||
|
||||
try {
|
||||
if (getServer().getPluginManager().getPlugin("Citizens") != null) {
|
||||
citizens = (CitizensPlugin) getServer().getPluginManager().getPlugin("Citizens");
|
||||
@ -185,11 +183,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
@Override
|
||||
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 {
|
||||
@ -199,28 +193,27 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
@Override
|
||||
public String getPromptText(ConversationContext context) {
|
||||
return "Accept Quest? " + formatFixedSet();
|
||||
|
||||
return ChatColor.YELLOW + "Accept Quest? " + ChatColor.GREEN + "Yes / No";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Prompt acceptValidatedInput(ConversationContext context, String s) {
|
||||
|
||||
Player player = (Player) context.getForWhom();
|
||||
if (s.equalsIgnoreCase("Yes") == false) {
|
||||
|
||||
if (s.equalsIgnoreCase("No")) {
|
||||
|
||||
player.sendMessage(ChatColor.YELLOW + "Cancelled.");
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
}
|
||||
|
||||
context.setSessionData("who", player.getName());
|
||||
context.setSessionData("message", s);
|
||||
|
||||
player.sendMessage(new SummoningConversationPrefix().getPrefix(context));
|
||||
|
||||
getQuester(player.getName()).takeQuest(getQuester(player.getName()).questToTake);
|
||||
getQuester(player.getName()).takeQuest(getQuest(getQuester(player.getName()).questToTake));
|
||||
|
||||
return Prompt.END_OF_CONVERSATION;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -228,8 +221,9 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
@Override
|
||||
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
|
||||
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
|
||||
|
||||
if(cmd.getName().equalsIgnoreCase("convo")){
|
||||
|
||||
if (cs instanceof Conversable) {
|
||||
conversationFactory.buildConversation((Conversable)cs).begin();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else if (cmd.getName().equalsIgnoreCase("quest")) {
|
||||
if (cmd.getName().equalsIgnoreCase("quest")) {
|
||||
|
||||
if (cs instanceof Player) {
|
||||
|
||||
@ -608,7 +593,6 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
|
||||
final Quest quest = questToFind;
|
||||
final Quester quester = getQuester(cs.getName());
|
||||
final CommandSender sender = cs;
|
||||
|
||||
if (quester.currentQuest != null) {
|
||||
cs.sendMessage(ChatColor.YELLOW + "You may only have one active Quest.");
|
||||
@ -633,7 +617,15 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
if (takeable == true) {
|
||||
|
||||
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();
|
||||
return true;
|
||||
}else{
|
||||
@ -2215,7 +2207,7 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
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)) {
|
||||
|
||||
@ -3547,4 +3539,14 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener{
|
||||
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
|
||||
main: me.blackvein.quests.Quests
|
||||
version: 1.4
|
||||
version: 1.5.0
|
||||
description: Player questing system
|
||||
website: http://dev.bukkit.org/server-mods/quests/
|
||||
dev-url: http://dev.bukkit.org/server-mods/quests/
|
||||
@ -66,6 +66,3 @@ commands:
|
||||
quest:
|
||||
description: Quest command
|
||||
permission: quests.quest
|
||||
convo:
|
||||
description: Convo command
|
||||
permission: quests.quest
|
Loading…
Reference in New Issue
Block a user