mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +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;
|
||||||
@ -3799,10 +3797,21 @@ 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,41 +22,45 @@ 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)
|
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
|
||||||
if(quester.currentStage.event != null)
|
|
||||||
quester.currentStage.event.happen(player);
|
|
||||||
|
|
||||||
quester.currentQuest.completeQuest(quester);
|
|
||||||
|
|
||||||
}else {
|
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
||||||
|
|
||||||
quester.reset();
|
if(quester.currentStage.script != null)
|
||||||
player.sendMessage(plugin.parseString(quester.currentStage.finished, quester.currentQuest));
|
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
||||||
if(quester.currentStage.script != null)
|
if(quester.currentStage.event != null)
|
||||||
plugin.trigger.parseQuestTaskTrigger(quester.currentStage.script, player);
|
quester.currentStage.event.happen(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.currentQuest.completeQuest(quester);
|
||||||
for(String s : quester.getObjectives()){
|
|
||||||
|
|
||||||
player.sendMessage(s);
|
}else {
|
||||||
|
|
||||||
|
quester.reset();
|
||||||
|
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)---");
|
||||||
|
for(String s : quester.getObjectives()){
|
||||||
|
|
||||||
|
player.sendMessage(s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quester.delayOver = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quester.delayOver = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user