This commit is contained in:
Blackvein 2012-11-05 11:35:28 -08:00
parent 97a48db886
commit b5481a7663
3 changed files with 59 additions and 33 deletions

View File

@ -26,6 +26,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerFishEvent.State;
import org.bukkit.event.player.*;
import org.bukkit.inventory.CraftingInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
@ -276,7 +277,19 @@ public class PlayerListener implements Listener {
if(evt.isShiftClick()){
evt.
final int amntBefore = Quests.countInv(evt.getInventory(), evt.getCurrentItem().getType());
final Material mat = evt.getCurrentItem().getType();
final Inventory inv = evt.getInventory();
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
@Override
public void run(){
int amntAfter = Quests.countInv(evt.getInventory(), mat);
}
}, 5);
}

View File

@ -25,9 +25,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.*;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
@ -3800,9 +3798,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
return null;
}
public int getCraftTimes(Inventory i, Recipe r){
public static int countInv(Inventory inv, Material m){
return 0;
int count = 0;
for(ItemStack i : inv.getContents()){
if(i != null){
if(i.getType().equals(m))
count += i.getAmount();
}
}
return count;
}
}

View File

@ -22,6 +22,8 @@ public class StageTimer implements Runnable{
Player player = plugin.getServer().getPlayerExact(quester.name);
if(quester.currentQuest != null){
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
if(quester.currentStage.script != null)
@ -59,4 +61,6 @@ public class StageTimer implements Runnable{
}
}
}