Merge remote-tracking branch 'origin/clans/beta' into clans/beta

This commit is contained in:
Shaun Bennett 2016-03-27 09:17:39 +11:00
commit 970d5a307c
3 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,64 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.fields;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.DefaultHashMap;
import mineplex.core.common.util.EnclosedObject;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.map.events.PlayerGetMapEvent;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.tutorial.tutorials.clans.objective.AttackEnemyObjective;
import mineplex.game.clans.tutorial.tutorials.clans.objective.FieldsObjective;
public class IdentifyFieldsGoal extends ObjectiveGoal<FieldsObjective>
{
private DefaultHashMap<String, EnclosedObject<Integer>> _ticksHeld = new DefaultHashMap<>(key -> new EnclosedObject<>(Integer.valueOf(0)));
public IdentifyFieldsGoal(FieldsObjective objective)
{
super(objective, "Identify The Fields", "By looking at your map, identify where the Fields are");
}
@Override
protected void customStart(Player player)
{
}
@Override
protected void customFinish(Player player)
{
}
@EventHandler
public void update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
getActivePlayers().forEach(uuid -> {
Player player = Bukkit.getPlayer(uuid);
if (player != null && player.isOnline())
{
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.MAP)
{
return;
}
_ticksHeld.get(player.getName()).Set(Integer.valueOf(_ticksHeld.get(player.getName()).Get().intValue() + 1));
if (_ticksHeld.get(player.getName()).Get().intValue() >= 80)
{
finish(player);
}
}
});
}
}

View File

@ -0,0 +1,28 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.tutorial.objective.Objective;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
public class BuyEnergyGoal extends ObjectiveGoal<FinalObjective>
{
public BuyEnergyGoal(FinalObjective objective)
{
super(objective, "Buy Energy", "Use the /c home command to teleport to your Clan Home");
}
@Override
protected void customStart(Player player)
{
}
@Override
protected void customFinish(Player player)
{
}
}

View File

@ -0,0 +1,44 @@
package mineplex.game.clans.tutorial.tutorials.clans.objective.goals.finalobj;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.game.clans.clans.event.ClansCommandPreExecutedEvent;
import mineplex.game.clans.tutorial.objective.Objective;
import mineplex.game.clans.tutorial.objective.ObjectiveGoal;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.event.ClansCommandExecutedEvent;
import mineplex.game.clans.tutorial.tutorials.clans.objective.FinalObjective;
public class EnergyLowGoal extends ObjectiveGoal<FinalObjective>
{
public EnergyLowGoal(FinalObjective objective)
{
super(objective, "Energy", "Energy is used for maintaining a Clan, and it's territory.");
}
@Override
protected void customStart(Player player)
{
UtilPlayer.message(player, F.main("Clans", "WARNING: Clan Energy is running very low!"));
UtilTextMiddle.display("Clan Energy", "is running very low", 10, 100, 10, player);
// Explain Energy
UtilPlayer.message(player, F.main("Clans", "Energy is required to maintain a Clan's territory, without it, any territory that your Clan owns will be claimed by the Wilderness, and anyone will be able to claim that territory. You can buy Energy at the Energy Shop in the Shops."));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1.0f, 1.0f);
ClansManager.getInstance().runSyncLater(() -> {
finish(player);
}, 3500l);
}
@Override
protected void customFinish(Player player)
{
}
}