More tutorial fixes

This commit is contained in:
Shaun Bennett 2016-04-04 14:47:33 +10:00
parent 040026724b
commit 543719b95d
4 changed files with 20 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
@ -193,6 +194,9 @@ public abstract class Tutorial implements Listener, ObjectiveListener
_worldManager.returnRegion(session.getRegion());
}
if (session.getSpawnHologram() != null)
session.getSpawnHologram().stop();
session.getHolograms().forEach(Hologram::stop);
}
}
@ -233,7 +237,8 @@ public abstract class Tutorial implements Listener, ObjectiveListener
int objectiveIndex = session.getObjectiveIndex();
Objective currentObjective = _objectives.get(objectiveIndex);
lines.add(C.cGoldB + (objectiveIndex + 1) + "/" + _objectives.size() + ": " + currentObjective.getName(player));
lines.add(C.cGreenB + currentObjective.getName(player));
lines.add(" ");
currentObjective.addScoreboardLines(player, lines);
}
return lines;
@ -273,6 +278,15 @@ public abstract class Tutorial implements Listener, ObjectiveListener
}
}
@EventHandler
public void onHungerChange(FoodLevelChangeEvent event)
{
if (event.getEntity() instanceof Player && isInTutorial(((Player) event.getEntity())))
{
event.setFoodLevel(20);
}
}
@EventHandler
public void displayDescription(UpdateEvent event)
{

View File

@ -147,6 +147,8 @@ public class ClansMainTutorial extends Tutorial
player.setGameMode(GameMode.SURVIVAL);
player.getInventory().clear();
player.getInventory().setArmorContents(new ItemStack[4]);
player.setHealth(20);
player.setFoodLevel(20);
//ClansManager.getInstance().getPvpTimer().pause(player);

View File

@ -25,7 +25,8 @@ public class FieldsObjective extends OrderedObjective<ClansMainTutorial>
Material.MAP,
"Identify Fields on Map",
"Find the Orange Striped Area on your Map",
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + "."
"Fields are marked by " + C.cGold + "Orange Stripes" + C.mBody + ".",
80L
));
addGoal(new GoToFieldsGoal(this));
addGoal(new MineDiamondsGoal(this));

View File

@ -8,6 +8,7 @@ import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.core.common.util.UtilPlayer;