mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-22 10:36:09 +01:00
Almost finished Stage time delay
> Add time delay reading to loadQuests()
This commit is contained in:
parent
ce2aabc98e
commit
028e33f7cf
@ -693,12 +693,12 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
Player player = evt.getPlayer();
|
Player player = evt.getPlayer();
|
||||||
if(plugin.checkQuester(player.getName()) == false){
|
if(plugin.checkQuester(player.getName()) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
if (quester.hasObjective("catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
if (quester.hasObjective("catchFish") && evt.getState().equals(State.CAUGHT_FISH)) {
|
||||||
quester.catchFish();
|
quester.catchFish();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -707,7 +707,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerDropItem(PlayerDropItemEvent evt) {
|
public void onPlayerDropItem(PlayerDropItemEvent evt) {
|
||||||
|
|
||||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
if (quester.currentQuest != null) {
|
if (quester.currentQuest != null) {
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerJoin(PlayerJoinEvent evt) {
|
public void onPlayerJoin(PlayerJoinEvent evt) {
|
||||||
|
|
||||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||||
|
|
||||||
Quester quester = new Quester(plugin);
|
Quester quester = new Quester(plugin);
|
||||||
quester.name = evt.getPlayer().getName();
|
quester.name = evt.getPlayer().getName();
|
||||||
if (new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()) {
|
if (new File(plugin.getDataFolder(), "data/" + quester.name + ".yml").exists()) {
|
||||||
@ -740,23 +740,29 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
for (String s : quester.completedQuests) {
|
for (String s : quester.completedQuests) {
|
||||||
|
|
||||||
for (Quest q : plugin.quests) {
|
Quest q = plugin.getQuest(s);
|
||||||
|
|
||||||
if (q.name.equalsIgnoreCase(s)) {
|
if (q != null) {
|
||||||
|
|
||||||
if (quester.completedTimes.containsKey(q.name) == false && q.redoDelay > -1) {
|
|
||||||
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (quester.completedTimes.containsKey(q.name) == false && q.redoDelay > -1)
|
||||||
|
quester.completedTimes.put(q.name, System.currentTimeMillis());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quester.checkQuest();
|
quester.checkQuest();
|
||||||
|
|
||||||
|
if(quester.currentQuest != null){
|
||||||
|
|
||||||
|
if(quester.currentStage.delay > -1){
|
||||||
|
|
||||||
|
quester.startStageTimer();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -765,11 +771,13 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerQuit(PlayerQuitEvent evt) {
|
public void onPlayerQuit(PlayerQuitEvent evt) {
|
||||||
|
|
||||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
Quester quester = plugin.getQuester(evt.getPlayer().getName());
|
||||||
|
if(quester.currentStage.delay > -1)
|
||||||
|
quester.stopStageTimer();
|
||||||
quester.saveData();
|
quester.saveData();
|
||||||
plugin.questers.remove(quester.name);
|
plugin.questers.remove(quester.name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -778,7 +786,7 @@ public class PlayerListener implements Listener {
|
|||||||
public void onPlayerMove(PlayerMoveEvent evt) {
|
public void onPlayerMove(PlayerMoveEvent evt) {
|
||||||
|
|
||||||
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
if(plugin.checkQuester(evt.getPlayer().getName()) == false){
|
||||||
|
|
||||||
boolean isPlayer = true;
|
boolean isPlayer = true;
|
||||||
if (plugin.getServer().getPluginManager().getPlugin("Citizens") != null) {
|
if (plugin.getServer().getPluginManager().getPlugin("Citizens") != null) {
|
||||||
if (plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer())) {
|
if (plugin.citizens.getNPCRegistry().isNPC(evt.getPlayer())) {
|
||||||
@ -797,7 +805,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,35 +62,46 @@ public class Quest {
|
|||||||
//
|
//
|
||||||
public void nextStage(Quester q){
|
public void nextStage(Quester q){
|
||||||
|
|
||||||
Player player = plugin.getServer().getPlayerExact(q.name);
|
if(q.currentStage.delay < 0){
|
||||||
|
|
||||||
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
|
Player player = plugin.getServer().getPlayerExact(q.name);
|
||||||
|
|
||||||
if(q.currentStage.script != null)
|
if(stages.indexOf(q.currentStage) == (stages.size() - 1)){
|
||||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
|
||||||
if(q.currentStage.event != null)
|
|
||||||
q.currentStage.event.happen(player);
|
|
||||||
|
|
||||||
completeQuest(q);
|
|
||||||
|
|
||||||
}else {
|
if(q.currentStage.script != null)
|
||||||
|
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||||
|
if(q.currentStage.event != null)
|
||||||
|
q.currentStage.event.happen(player);
|
||||||
|
|
||||||
q.reset();
|
completeQuest(q);
|
||||||
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
|
|
||||||
if(q.currentStage.script != null)
|
|
||||||
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
|
||||||
if(q.currentStage.event != null)
|
|
||||||
q.currentStage.event.happen(player);
|
|
||||||
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
|
|
||||||
q.addEmpties();
|
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
}else {
|
||||||
for(String s : q.getObjectives()){
|
|
||||||
|
|
||||||
player.sendMessage(s);
|
q.reset();
|
||||||
|
player.sendMessage(plugin.parseString(q.currentStage.finished, q.currentQuest));
|
||||||
|
if(q.currentStage.script != null)
|
||||||
|
plugin.trigger.parseQuestTaskTrigger(q.currentStage.script, player);
|
||||||
|
if(q.currentStage.event != null)
|
||||||
|
q.currentStage.event.happen(player);
|
||||||
|
q.currentStage = stages.get(stages.indexOf(q.currentStage) + 1);
|
||||||
|
q.addEmpties();
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||||
|
for(String s : q.getObjectives()){
|
||||||
|
|
||||||
|
player.sendMessage(s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
q.delayStartTime = 0;
|
||||||
|
q.delayTimeLeft = -1;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
q.startStageTimer();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -98,7 +109,7 @@ public class Quest {
|
|||||||
public String getName(){
|
public String getName(){
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean testRequirements(Player player){
|
public boolean testRequirements(Player player){
|
||||||
|
|
||||||
Quester quester = plugin.getQuester(player.getName());
|
Quester quester = plugin.getQuester(player.getName());
|
||||||
@ -201,7 +212,7 @@ public class Quest {
|
|||||||
|
|
||||||
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
|
plugin.getServer().dispatchCommand(plugin.getServer().getConsoleSender(), s);
|
||||||
none = null;
|
none = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String s : permissions){
|
for(String s : permissions){
|
||||||
@ -215,7 +226,7 @@ public class Quest {
|
|||||||
|
|
||||||
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
|
Quests.mcmmo.getPlayerProfile(player.getName()).skillUp(Quests.getMcMMOSkill(s), mcmmoAmounts.get(mcmmoSkills.indexOf(s)));
|
||||||
none = null;
|
none = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(exp > 0){
|
if(exp > 0){
|
||||||
@ -227,12 +238,12 @@ public class Quest {
|
|||||||
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
|
plugin.heroes.getCharacterManager().getHero(player).gainExp(heroesExp, ExperienceType.QUESTING, player.getLocation());
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(heroesClass != null){
|
if(heroesClass != null){
|
||||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
|
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesClass), false);
|
||||||
none = null;
|
none = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(heroesSecClass != null){
|
if(heroesSecClass != null){
|
||||||
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
|
plugin.heroes.getCharacterManager().getHero(player).changeHeroClass(plugin.heroes.getClassManager().getClass(heroesSecClass), true);
|
||||||
none = null;
|
none = null;
|
||||||
|
@ -379,7 +379,7 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (NPC n : currentStage.citizensToKill) {
|
for (NPC n : currentStage.citizensToKill) {
|
||||||
|
|
||||||
for (NPC n2 : citizensKilled) {
|
for (NPC n2 : citizensKilled) {
|
||||||
@ -884,20 +884,20 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void killNPC(NPC n) {
|
public void killNPC(NPC n) {
|
||||||
|
|
||||||
if(citizensKilled.contains(n)){
|
if(citizensKilled.contains(n)){
|
||||||
|
|
||||||
int index = citizensKilled.indexOf(n);
|
int index = citizensKilled.indexOf(n);
|
||||||
if(citizenNumKilled.get(index) < currentStage.citizenNumToKill.get(index)){
|
if(citizenNumKilled.get(index) < currentStage.citizenNumToKill.get(index)){
|
||||||
citizenNumKilled.set(index, citizenNumKilled.get(index) + 1);
|
citizenNumKilled.set(index, citizenNumKilled.get(index) + 1);
|
||||||
if(citizenNumKilled.get(index) == currentStage.citizenNumToKill.get(index))
|
if(citizenNumKilled.get(index) == currentStage.citizenNumToKill.get(index))
|
||||||
finishObjective("killNPC", null, null, null, null, null, n, null, null, 0);
|
finishObjective("killNPC", null, null, null, null, null, n, null, null, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reachLocation(Location l) {
|
public void reachLocation(Location l) {
|
||||||
@ -1244,7 +1244,7 @@ public class Quester {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentStage.citizensToKill.isEmpty() == false) {
|
if (currentStage.citizensToKill.isEmpty() == false) {
|
||||||
for (NPC n : currentStage.citizensToKill) {
|
for (NPC n : currentStage.citizensToKill) {
|
||||||
|
|
||||||
@ -1777,9 +1777,9 @@ public class Quester {
|
|||||||
data.set("has-talked-to", hasTalked);
|
data.set("has-talked-to", hasTalked);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(citizensKilled.isEmpty() == false) {
|
if(citizensKilled.isEmpty() == false) {
|
||||||
|
|
||||||
LinkedList<Integer> npcIds = new LinkedList<Integer>();
|
LinkedList<Integer> npcIds = new LinkedList<Integer>();
|
||||||
|
|
||||||
for (NPC n : citizensKilled) {
|
for (NPC n : citizensKilled) {
|
||||||
@ -1790,7 +1790,7 @@ public class Quester {
|
|||||||
|
|
||||||
data.set("citizen-ids-killed", npcIds);
|
data.set("citizen-ids-killed", npcIds);
|
||||||
data.set("citizen-amounts-killed", citizenNumKilled);
|
data.set("citizen-amounts-killed", citizenNumKilled);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (locationsReached.isEmpty() == false) {
|
if (locationsReached.isEmpty() == false) {
|
||||||
@ -1886,12 +1886,9 @@ public class Quester {
|
|||||||
data.set("items-crafted", itemAmounts);
|
data.set("items-crafted", itemAmounts);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(delayStartTime > 0){
|
if(delayTimeLeft > 0)
|
||||||
|
data.set("stage-delay", delayTimeLeft);
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -2376,7 +2373,7 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("citizen-ids-killed")) {
|
if (data.contains("citizen-ids-killed")) {
|
||||||
|
|
||||||
List<Integer> ids = data.getIntegerList("citizen-ids-killed");
|
List<Integer> ids = data.getIntegerList("citizen-ids-killed");
|
||||||
@ -2559,11 +2556,11 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.contains("stage-delay")){
|
if(data.contains("stage-delay")){
|
||||||
|
|
||||||
delayTimeLeft = data.getLong("stage-delay");
|
delayTimeLeft = data.getLong("stage-delay");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2573,27 +2570,36 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void startStageTimer(){
|
public void startStageTimer(){
|
||||||
|
|
||||||
if(delayTimeLeft > -1)
|
if(delayTimeLeft > -1)
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(this), delayTimeLeft*50);
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), delayTimeLeft*50);
|
||||||
else
|
else
|
||||||
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(this), currentStage.delay);
|
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new StageTimer(plugin, this), currentStage.delay);
|
||||||
|
|
||||||
delayStartTime = System.currentTimeMillis();
|
delayStartTime = System.currentTimeMillis();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopTimer(){
|
public void stopStageTimer(){
|
||||||
|
|
||||||
if(delayTimeLeft > -1)
|
if(delayTimeLeft > -1)
|
||||||
delayTimeLeft = delayTimeLeft - (System.currentTimeMillis() - delayStartTime);
|
delayTimeLeft = delayTimeLeft - (System.currentTimeMillis() - delayStartTime);
|
||||||
else
|
else
|
||||||
delayTimeLeft = currentStage.delay - (System.currentTimeMillis() - delayStartTime);
|
delayTimeLeft = currentStage.delay - (System.currentTimeMillis() - delayStartTime);
|
||||||
|
|
||||||
delayOver = false;
|
delayOver = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getStageTime(){
|
||||||
|
|
||||||
|
if(delayTimeLeft > -1)
|
||||||
|
return delayTimeLeft - (System.currentTimeMillis() - delayStartTime);
|
||||||
|
else
|
||||||
|
return currentStage.delay - (System.currentTimeMillis() - delayStartTime);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void checkQuest() {
|
public void checkQuest() {
|
||||||
|
|
||||||
if (currentQuest != null) {
|
if (currentQuest != null) {
|
||||||
@ -2636,80 +2642,80 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String checkPlacement(Inventory inv, int rawSlot){
|
public static String checkPlacement(Inventory inv, int rawSlot){
|
||||||
|
|
||||||
if(rawSlot < 0){
|
if(rawSlot < 0){
|
||||||
return "You may not drop Quest items.";
|
return "You may not drop Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryType type = inv.getType();
|
InventoryType type = inv.getType();
|
||||||
|
|
||||||
if(type.equals(InventoryType.BREWING)){
|
if(type.equals(InventoryType.BREWING)){
|
||||||
|
|
||||||
if(rawSlot < 4){
|
if(rawSlot < 4){
|
||||||
return "You may not brew using Quest items.";
|
return "You may not brew using Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.CHEST)){
|
}else if(type.equals(InventoryType.CHEST)){
|
||||||
|
|
||||||
if(inv.getContents().length == 27){
|
if(inv.getContents().length == 27){
|
||||||
|
|
||||||
if(rawSlot < 27){
|
if(rawSlot < 27){
|
||||||
return "You may not store Quest items.";
|
return "You may not store Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
if(rawSlot < 54){
|
if(rawSlot < 54){
|
||||||
return "You may not store Quest items.";
|
return "You may not store Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.CRAFTING)){
|
}else if(type.equals(InventoryType.CRAFTING)){
|
||||||
|
|
||||||
if(rawSlot < 5){
|
if(rawSlot < 5){
|
||||||
return "You may not craft using Quest items.";
|
return "You may not craft using Quest items.";
|
||||||
}else if(rawSlot < 9){
|
}else if(rawSlot < 9){
|
||||||
return "You may not equip Quest items.";
|
return "You may not equip Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.DISPENSER)){
|
}else if(type.equals(InventoryType.DISPENSER)){
|
||||||
|
|
||||||
if(rawSlot < 9){
|
if(rawSlot < 9){
|
||||||
return "You may not put Quest items in dispensers.";
|
return "You may not put Quest items in dispensers.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.ENCHANTING)){
|
}else if(type.equals(InventoryType.ENCHANTING)){
|
||||||
|
|
||||||
if(rawSlot == 0){
|
if(rawSlot == 0){
|
||||||
return "You may not enchant Quest items.";
|
return "You may not enchant Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.ENDER_CHEST)){
|
}else if(type.equals(InventoryType.ENDER_CHEST)){
|
||||||
|
|
||||||
if(rawSlot < 27){
|
if(rawSlot < 27){
|
||||||
return "You may not store Quest items.";
|
return "You may not store Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.FURNACE)){
|
}else if(type.equals(InventoryType.FURNACE)){
|
||||||
|
|
||||||
if(rawSlot < 3){
|
if(rawSlot < 3){
|
||||||
return "You may not smelt using Quest items.";
|
return "You may not smelt using Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}else if(type.equals(InventoryType.WORKBENCH)){
|
}else if(type.equals(InventoryType.WORKBENCH)){
|
||||||
|
|
||||||
if(rawSlot < 10){
|
if(rawSlot < 10){
|
||||||
return "You may not craft using Quest items.";
|
return "You may not craft using Quest items.";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew)
|
public static List<Integer> getChangedSlots(Inventory inInv, ItemStack inNew)
|
||||||
{
|
{
|
||||||
List<Integer> changed = new ArrayList<Integer>();
|
List<Integer> changed = new ArrayList<Integer>();
|
||||||
@ -2721,7 +2727,7 @@ public class Quester {
|
|||||||
{
|
{
|
||||||
if(!items.containsKey((Integer)i))
|
if(!items.containsKey((Integer)i))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemStack item = items.get((Integer)i);
|
ItemStack item = items.get((Integer)i);
|
||||||
int slotamount = item.getMaxStackSize() - item.getAmount();
|
int slotamount = item.getMaxStackSize() - item.getAmount();
|
||||||
if(slotamount > 1)
|
if(slotamount > 1)
|
||||||
@ -2740,7 +2746,7 @@ public class Quester {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(amount > 0)
|
if(amount > 0)
|
||||||
{
|
{
|
||||||
if(inInv.firstEmpty() != -1)
|
if(inInv.firstEmpty() != -1)
|
||||||
|
@ -1,24 +1,63 @@
|
|||||||
package me.blackvein.quests;
|
package me.blackvein.quests;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class StageTimer implements Runnable{
|
public class StageTimer implements Runnable{
|
||||||
|
|
||||||
Quester quester;
|
Quester quester;
|
||||||
|
Quests plugin;
|
||||||
public StageTimer(Quester q){
|
|
||||||
|
public StageTimer(Quests quests, Quester q){
|
||||||
|
|
||||||
quester = q;
|
quester = q;
|
||||||
|
plugin = quests;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(){
|
public void run(){
|
||||||
|
|
||||||
if(quester.delayOver){
|
if(quester.delayOver){
|
||||||
quester.currentQuest.nextStage(quester);
|
|
||||||
|
Player player = plugin.getServer().getPlayerExact(quester.name);
|
||||||
|
|
||||||
|
if(quester.currentQuest.stages.indexOf(quester.currentStage) == (quester.currentQuest.stages.size() - 1)){
|
||||||
|
|
||||||
|
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 {
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
player.sendMessage(ChatColor.GOLD + "---(Objectives)---");
|
||||||
|
for(String s : quester.getObjectives()){
|
||||||
|
|
||||||
|
player.sendMessage(s);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
quester.delayStartTime = 0;
|
||||||
|
quester.delayTimeLeft = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quester.delayOver = true;
|
quester.delayOver = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user