This commit is contained in:
Blackvein 2012-10-29 12:04:31 -07:00
parent 6548d93787
commit 173d33520f
3 changed files with 58 additions and 46 deletions

View File

@ -26,7 +26,8 @@ public class NpcListener implements Listener {
final Player player = evt.getClicker(); final Player player = evt.getClicker();
if(Quests.checkQuester()) if(plugin.checkQuester(player.getName()) == false){
final Quester quester = plugin.getQuester(player.getName()); final Quester quester = plugin.getQuester(player.getName());
if (quester.hasObjective("talkToNPC")) { if (quester.hasObjective("talkToNPC")) {
@ -100,6 +101,8 @@ public class NpcListener implements Listener {
} }
}
@EventHandler @EventHandler
public void onNPCDespawn(NPCDespawnEvent evt) { public void onNPCDespawn(NPCDespawnEvent evt) {
} }

View File

@ -24,6 +24,7 @@ import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent; import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.player.PlayerFishEvent.State; import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.*; import org.bukkit.event.player.*;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
@ -468,13 +469,14 @@ public class PlayerListener implements Listener {
}else{ }else{
ItemStack oldStack = evt.getCurrentItem(); ItemStack oldStack = evt.getCurrentItem();
HashMap<Integer, ItemStack> map = evt.getInventory().addItem(oldStack); Inventory inv = plugin.getServer().createInventory(null, evt.getInventory().getType());
HashMap<Integer, ItemStack> map = inv.addItem(oldStack);
if(map.isEmpty() == false){ if(map.isEmpty() == false){
ItemStack newStack = oldStack.clone(); ItemStack newStack = oldStack.clone();
newStack.setAmount(old) newStack.setAmount(oldStack.getAmount() - map.get(0).getAmount());
quester.collectItem(newStack);
}else{ }else{
quester.collectItem(oldStack); quester.collectItem(oldStack);

View File

@ -38,7 +38,7 @@ 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;
public static mcMMO mcmmo = null; public static mcMMO mcmmo = null;
HashSet<String> questerBlacklist = new HashSet<String>(); List<String> questerBlacklist = new LinkedList<String>();
ConversationFactory conversationFactory; ConversationFactory conversationFactory;
QuestFactory questFactory; QuestFactory questFactory;
Heroes heroes; Heroes heroes;
@ -3685,9 +3685,16 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return true; return true;
} }
public static boolean checkQuester(String name){ public boolean checkQuester(String name){
for(String s : questerBlacklist){
if(Quests.checkQuester(name, s))
return true;
}
return false;
} }