mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 18:45:27 +01:00
Unstable
This commit is contained in:
parent
97a48db886
commit
b5481a7663
@ -26,6 +26,7 @@ import org.bukkit.event.inventory.InventoryCloseEvent;
|
|||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
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.CraftingInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -276,7 +277,19 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
if(evt.isShiftClick()){
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,9 +25,7 @@ import org.bukkit.enchantments.Enchantment;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.*;
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
@ -3800,9 +3798,20 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
|
|||||||
return null;
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,40 +22,44 @@ public class StageTimer implements Runnable{
|
|||||||
|
|
||||||
Player player = plugin.getServer().getPlayerExact(quester.name);
|
Player player = plugin.getServer().getPlayerExact(quester.name);
|
||||||
|
|
||||||
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
if(quester.currentQuest != null){
|
||||||
|
|
||||||
if(quester.currentStage.script != null)
|
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
|
||||||
if(quester.currentStage.event != null)
|
|
||||||
quester.currentStage.event.happen(player);
|
|
||||||
|
|
||||||
quester.currentQuest.completeQuest(quester);
|
if(quester.currentStage.script != null)
|
||||||
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||||
|
if(quester.currentStage.event != null)
|
||||||
|
quester.currentStage.event.happen(player);
|
||||||
|
|
||||||
}else {
|
quester.currentQuest.completeQuest(quester);
|
||||||
|
|
||||||
quester.reset();
|
}else {
|
||||||
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
|
|
||||||
if(quester.currentStage.script != null)
|
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
|
||||||
if(quester.currentStage.event != null)
|
|
||||||
quester.currentStage.event.happen(player);
|
|
||||||
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
|
|
||||||
quester.addEmpties();
|
|
||||||
quester.delayStartTime = 0;
|
|
||||||
quester.delayTimeLeft = -1;
|
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
quester.reset();
|
||||||
for(String s : quester.getObjectives()){
|
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
|
||||||
|
if(quester.currentStage.script != null)
|
||||||
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||||
|
if(quester.currentStage.event != null)
|
||||||
|
quester.currentStage.event.happen(player);
|
||||||
|
quester.currentStage = quester.currentQuest.stages.get(quester.currentQuest.stages.indexOf(quester.currentStage) + 1);
|
||||||
|
quester.addEmpties();
|
||||||
|
quester.delayStartTime = 0;
|
||||||
|
quester.delayTimeLeft = -1;
|
||||||
|
|
||||||
player.sendMessage(s);
|
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||||
|
for(String s : quester.getObjectives()){
|
||||||
|
|
||||||
|
player.sendMessage(s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
quester.delayOver = true;
|
||||||
|
|
||||||
quester.delayOver = true;
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user